From 581d75bb3ba04fac9aba77e4500ba52181439671 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 26 Dec 2024 07:54:15 +0000 Subject: [PATCH] CodeGen from PR 31959 in Azure/azure-rest-api-specs Merge 12a7fb8e8b1411718ad6325db3c6cbc4bf0b597e into 64f6997950d8bee63f314563cedaa20148db2186 --- .../_meta.json | 8 +- .../activestamp/__init__.py | 12 +- .../activestamp/_configuration.py | 1 - .../_recovery_services_backup_client.py | 6 +- .../activestamp/_serialization.py | 438 ++++++---- .../activestamp/_vendor.py | 11 - .../activestamp/_version.py | 2 +- .../activestamp/aio/__init__.py | 12 +- .../activestamp/aio/_configuration.py | 1 - .../aio/_recovery_services_backup_client.py | 6 +- .../activestamp/aio/_vendor.py | 3 - .../activestamp/aio/operations/__init__.py | 118 +-- .../operations/_backup_engines_operations.py | 21 +- .../aio/operations/_backup_jobs_operations.py | 15 +- .../_backup_operation_results_operations.py | 18 +- .../_backup_operation_statuses_operations.py | 16 +- .../operations/_backup_policies_operations.py | 16 +- .../_backup_protectable_items_operations.py | 16 +- .../_backup_protected_items_operations.py | 16 +- ...backup_protection_containers_operations.py | 16 +- .../_backup_protection_intent_operations.py | 16 +- ..._resource_encryption_configs_operations.py | 27 +- ...urce_storage_configs_non_crr_operations.py | 30 +- ...ackup_resource_vault_configs_operations.py | 26 +- .../operations/_backup_status_operations.py | 16 +- .../_backup_usage_summaries_operations.py | 16 +- .../_backup_workload_items_operations.py | 16 +- .../aio/operations/_backups_operations.py | 20 +- ...e_data_move_operation_result_operations.py | 18 +- ...eleted_protection_containers_operations.py | 16 +- ...xport_jobs_operation_results_operations.py | 20 +- .../operations/_feature_support_operations.py | 16 +- .../_fetch_tiering_cost_operations.py | 38 +- ...iering_cost_operation_result_operations.py | 16 +- ...m_level_recovery_connections_operations.py | 25 +- .../_job_cancellations_operations.py | 18 +- .../aio/operations/_job_details_operations.py | 16 +- .../_job_operation_results_operations.py | 16 +- .../aio/operations/_jobs_operations.py | 16 +- .../aio/operations/_operation_operations.py | 16 +- .../activestamp/aio/operations/_operations.py | 16 +- ..._private_endpoint_connection_operations.py | 71 +- .../_private_endpoint_operations.py | 16 +- .../_protectable_containers_operations.py | 16 +- ...ected_item_operation_results_operations.py | 16 +- ...cted_item_operation_statuses_operations.py | 16 +- .../operations/_protected_items_operations.py | 26 +- ..._container_operation_results_operations.py | 16 +- ...er_refresh_operation_results_operations.py | 16 +- .../_protection_containers_operations.py | 59 +- .../_protection_intent_operations.py | 31 +- .../_protection_policies_operations.py | 50 +- ...ion_policy_operation_results_operations.py | 16 +- ...on_policy_operation_statuses_operations.py | 16 +- .../operations/_recovery_points_operations.py | 21 +- ..._points_recommended_for_move_operations.py | 18 +- ...overy_services_backup_client_operations.py | 95 ++- .../_resource_guard_proxies_operations.py | 16 +- .../_resource_guard_proxy_operations.py | 31 +- .../aio/operations/_restores_operations.py | 40 +- .../operations/_security_pins_operations.py | 16 +- ...iering_cost_operation_status_operations.py | 16 +- .../_validate_operation_operations.py | 40 +- .../_validate_operation_results_operations.py | 16 +- ..._validate_operation_statuses_operations.py | 16 +- .../activestamp/models/__init__.py | 781 +++++++++--------- .../activestamp/models/_models_py3.py | 145 ++-- .../activestamp/operations/__init__.py | 118 +-- .../operations/_backup_engines_operations.py | 19 +- .../operations/_backup_jobs_operations.py | 14 +- .../_backup_operation_results_operations.py | 13 +- .../_backup_operation_statuses_operations.py | 15 +- .../operations/_backup_policies_operations.py | 14 +- .../_backup_protectable_items_operations.py | 15 +- .../_backup_protected_items_operations.py | 14 +- ...backup_protection_containers_operations.py | 14 +- .../_backup_protection_intent_operations.py | 14 +- ..._resource_encryption_configs_operations.py | 24 +- ...urce_storage_configs_non_crr_operations.py | 27 +- ...ackup_resource_vault_configs_operations.py | 25 +- .../operations/_backup_status_operations.py | 15 +- .../_backup_usage_summaries_operations.py | 14 +- .../_backup_workload_items_operations.py | 14 +- .../operations/_backups_operations.py | 17 +- ...e_data_move_operation_result_operations.py | 17 +- ...eleted_protection_containers_operations.py | 14 +- ...xport_jobs_operation_results_operations.py | 19 +- .../operations/_feature_support_operations.py | 15 +- .../_fetch_tiering_cost_operations.py | 37 +- ...iering_cost_operation_result_operations.py | 15 +- ...m_level_recovery_connections_operations.py | 20 +- .../_job_cancellations_operations.py | 13 +- .../operations/_job_details_operations.py | 15 +- .../_job_operation_results_operations.py | 13 +- .../operations/_jobs_operations.py | 13 +- .../operations/_operation_operations.py | 15 +- .../activestamp/operations/_operations.py | 15 +- ..._private_endpoint_connection_operations.py | 70 +- .../_private_endpoint_operations.py | 15 +- .../_protectable_containers_operations.py | 15 +- ...ected_item_operation_results_operations.py | 15 +- ...cted_item_operation_statuses_operations.py | 15 +- .../operations/_protected_items_operations.py | 23 +- ..._container_operation_results_operations.py | 15 +- ...er_refresh_operation_results_operations.py | 13 +- .../_protection_containers_operations.py | 52 +- .../_protection_intent_operations.py | 28 +- .../_protection_policies_operations.py | 49 +- ...ion_policy_operation_results_operations.py | 15 +- ...on_policy_operation_statuses_operations.py | 15 +- .../operations/_recovery_points_operations.py | 19 +- ..._points_recommended_for_move_operations.py | 14 +- ...overy_services_backup_client_operations.py | 96 ++- .../_resource_guard_proxies_operations.py | 15 +- .../_resource_guard_proxy_operations.py | 28 +- .../operations/_restores_operations.py | 39 +- .../operations/_security_pins_operations.py | 15 +- ...iering_cost_operation_status_operations.py | 15 +- .../_validate_operation_operations.py | 39 +- .../_validate_operation_results_operations.py | 15 +- ..._validate_operation_statuses_operations.py | 15 +- .../passivestamp/__init__.py | 12 +- .../passivestamp/_configuration.py | 1 - ...recovery_services_backup_passive_client.py | 6 +- .../passivestamp/_serialization.py | 438 ++++++---- .../passivestamp/_vendor.py | 16 - .../passivestamp/_version.py | 2 +- .../passivestamp/aio/__init__.py | 12 +- .../passivestamp/aio/_configuration.py | 1 - ...recovery_services_backup_passive_client.py | 6 +- .../passivestamp/aio/operations/__init__.py | 32 +- .../operations/_aad_properties_operations.py | 15 +- .../_backup_crr_job_details_operations.py | 15 +- .../operations/_backup_crr_jobs_operations.py | 14 +- .../_backup_protected_items_crr_operations.py | 15 +- ...kup_resource_storage_configs_operations.py | 29 +- .../_backup_usage_summaries_crr_operations.py | 15 +- .../_cross_region_restore_operations.py | 39 +- .../_crr_operation_results_operations.py | 17 +- .../_crr_operation_status_operations.py | 15 +- .../_recovery_points_crr_operations.py | 20 +- .../operations/_recovery_points_operations.py | 16 +- .../passivestamp/models/__init__.py | 317 +++---- .../passivestamp/models/_models_py3.py | 59 +- .../passivestamp/operations/__init__.py | 32 +- .../operations/_aad_properties_operations.py | 15 +- .../_backup_crr_job_details_operations.py | 15 +- .../operations/_backup_crr_jobs_operations.py | 14 +- .../_backup_protected_items_crr_operations.py | 14 +- ...kup_resource_storage_configs_operations.py | 27 +- .../_backup_usage_summaries_crr_operations.py | 14 +- .../_cross_region_restore_operations.py | 39 +- .../_crr_operation_results_operations.py | 13 +- .../_crr_operation_status_operations.py | 15 +- .../_recovery_points_crr_operations.py | 19 +- .../operations/_recovery_points_operations.py | 16 +- .../azure_iaas_vm/backup_feature_validate.py | 2 - .../azure_iaas_vm/configure_protection.py | 2 - .../azure_iaas_vm/get_backup_status.py | 2 - .../protection_intent_create_or_update.py | 2 - .../protection_intent_validate.py | 2 - ...ction_policies_create_or_update_complex.py | 2 - ...ection_policies_create_or_update_simple.py | 2 - .../azure_iaas_vm/provision_ilr.py | 2 - ...covery_points_recommended_for_move_list.py | 2 - .../azure_iaas_vm/stop_protection.py | 2 - ...ger_restore_alr_iaas_vm_restore_request.py | 2 - ..._request_identity_based_restore_details.py | 2 - ...aas_vm_restore_with_rehydration_request.py | 2 - ...e_restore_disks_iaas_vm_restore_request.py | 2 - ..._request_identity_based_restore_details.py | 2 - ...aas_vm_restore_with_rehydration_request.py | 2 - ...trigger_validate_operation_restore_disk.py | 2 - .../azure_iaas_vm/v2_policy/iaa_s_v2_daily.py | 2 - .../v2_policy/iaa_s_v2_hourly.py | 2 - .../validate_operation_restore_disk.py | 2 - ...ore_disk_identity_based_restore_details.py | 2 - .../protection_containers_register.py | 2 - ...tection_policies_create_or_update_daily.py | 2 - ...tion_policies_create_or_update_hardened.py | 2 - ...ection_policies_create_or_update_hourly.py | 2 - ...ction_policies_create_or_update_complex.py | 2 - .../prepare_data_move_post.py | 2 - .../trigger_data_move_post.py | 2 - .../backup_resource_encryption_config_put.py | 2 - .../backup_resource_vault_configs_patch.py | 2 - .../backup_resource_vault_configs_put.py | 2 - .../common/backup_storage_config_patch.py | 2 - .../common/backup_storage_config_put.py | 2 - .../activestamp/common/trigger_backup_post.py | 2 - .../put_private_endpoint_connection.py | 2 - .../put_resource_guard_proxy.py | 2 - .../unlock_delete_resource_guard_proxy.py | 2 - .../fetch_tiering_cost_for_policy.py | 2 - .../fetch_tiering_cost_for_protected_item.py | 2 - .../fetch_tiering_cost_for_rehydrate.py | 2 - .../fetch_tiering_cost_for_vault.py | 2 - .../trigger_recovery_point_move_post.py | 2 - .../azure_iaas_vm/get_access_token_get.py | 2 - .../azure_iaas_vm/get_crr_job_post.py | 2 - .../azure_iaas_vm/list_crr_jobs_post.py | 2 - ...ore_identity_based_restore_details_post.py | 87 ++ .../trigger_cross_region_restore_post.py | 85 ++ .../common/backup_storage_config_patch.py | 2 - .../common/backup_storage_config_put.py | 2 - .../setup.py | 1 + 206 files changed, 3092 insertions(+), 2559 deletions(-) delete mode 100644 sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_vendor.py create mode 100644 sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/passivestamp/azure_iaas_vm/trigger_cross_region_restore_identity_based_restore_details_post.py create mode 100644 sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/passivestamp/azure_iaas_vm/trigger_cross_region_restore_post.py diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/_meta.json b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/_meta.json index e0769101898e..c39e5b576be1 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/_meta.json +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/_meta.json @@ -1,11 +1,11 @@ { - "commit": "2897e4040dd3d922061ae55bc002358aeaded619", + "commit": "486f42823c8b382cd81f0a0a959740b5a0a13b87", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.7", + "autorest": "3.10.2", "use": [ - "@autorest/python@6.13.7", + "@autorest/python@6.27.2", "@autorest/modelerfour@4.27.0" ], - "autorest_command": "autorest specification/recoveryservicesbackup/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.13.7 --use=@autorest/modelerfour@4.27.0 --version=3.9.7 --version-tolerant=False", + "autorest_command": "autorest specification/recoveryservicesbackup/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.27.2 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", "readme": "specification/recoveryservicesbackup/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/__init__.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/__init__.py index 4365d800f0cd..82cbe78128c0 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/__init__.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/__init__.py @@ -5,15 +5,21 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._recovery_services_backup_client import RecoveryServicesBackupClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._recovery_services_backup_client import RecoveryServicesBackupClient # type: ignore from ._version import VERSION __version__ = VERSION try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -21,6 +27,6 @@ __all__ = [ "RecoveryServicesBackupClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_configuration.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_configuration.py index faef70e51a05..ae64641a4fe7 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_configuration.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_configuration.py @@ -14,7 +14,6 @@ from ._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_recovery_services_backup_client.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_recovery_services_backup_client.py index 6e682578ce80..4da24b17c760 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_recovery_services_backup_client.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_recovery_services_backup_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -74,13 +75,12 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential class RecoveryServicesBackupClient( RecoveryServicesBackupClientOperationsMixin -): # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +): # pylint: disable=too-many-instance-attributes """Open API 2.0 Specs for Azure RecoveryServices Backup service. :ivar backup_resource_storage_configs_non_crr: BackupResourceStorageConfigsNonCRROperations @@ -443,7 +443,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "RecoveryServicesBackupClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_serialization.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_serialization.py index 2f781d740827..b24ab2885450 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_serialization.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_serialization.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # # Copyright (c) Microsoft Corporation. All rights reserved. @@ -24,7 +25,6 @@ # # -------------------------------------------------------------------------- -# pylint: skip-file # pyright: reportUnnecessaryTypeIgnoreComment=false from base64 import b64decode, b64encode @@ -52,7 +52,6 @@ MutableMapping, Type, List, - Mapping, ) try: @@ -91,6 +90,8 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: :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. + :return: The deserialized data. + :rtype: object """ if hasattr(data, "read"): # Assume a stream @@ -112,7 +113,7 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: try: return json.loads(data_as_str) except ValueError as err: - raise DeserializationError("JSON is invalid: {}".format(err), err) + raise DeserializationError("JSON is invalid: {}".format(err), err) from err elif "xml" in (content_type or []): try: @@ -144,6 +145,8 @@ def _json_attemp(data): # context otherwise. _LOGGER.critical("Wasn't XML not JSON, failing") raise DeserializationError("XML is invalid") from err + elif content_type.startswith("text/"): + return data_as_str raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod @@ -153,6 +156,11 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], Use bytes and headers to NOT use any requests/aiohttp or whatever specific implementation. Headers will tested for "content-type" + + :param bytes body_bytes: The body of the response. + :param dict headers: The headers of the response. + :returns: The deserialized data. + :rtype: object """ # Try to use content-type from headers if available content_type = None @@ -182,15 +190,30 @@ class UTC(datetime.tzinfo): """Time Zone info for handling UTC""" def utcoffset(self, dt): - """UTF offset for UTC is 0.""" + """UTF offset for UTC is 0. + + :param datetime.datetime dt: The datetime + :returns: The offset + :rtype: datetime.timedelta + """ return datetime.timedelta(0) def tzname(self, dt): - """Timestamp representation.""" + """Timestamp representation. + + :param datetime.datetime dt: The datetime + :returns: The timestamp representation + :rtype: str + """ return "Z" def dst(self, dt): - """No daylight saving for UTC.""" + """No daylight saving for UTC. + + :param datetime.datetime dt: The datetime + :returns: The daylight saving time + :rtype: datetime.timedelta + """ return datetime.timedelta(hours=1) @@ -204,7 +227,7 @@ class _FixedOffset(datetime.tzinfo): # type: ignore :param datetime.timedelta offset: offset in timedelta format """ - def __init__(self, offset): + def __init__(self, offset) -> None: self.__offset = offset def utcoffset(self, dt): @@ -233,24 +256,26 @@ def __getinitargs__(self): _FLATTEN = re.compile(r"(? None: self.additional_properties: Optional[Dict[str, Any]] = {} - for k in kwargs: + for k in kwargs: # pylint: disable=consider-using-dict-items if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) elif k in self._validation and self._validation[k].get("readonly", False): @@ -298,13 +330,23 @@ def __init__(self, **kwargs: Any) -> None: setattr(self, k, kwargs[k]) def __eq__(self, other: Any) -> bool: - """Compare objects by comparing all attributes.""" + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are equal + :rtype: bool + """ if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False def __ne__(self, other: Any) -> bool: - """Compare objects by comparing all attributes.""" + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are not equal + :rtype: bool + """ return not self.__eq__(other) def __str__(self) -> str: @@ -324,7 +366,11 @@ def is_xml_model(cls) -> bool: @classmethod def _create_xml_node(cls): - """Create XML node.""" + """Create XML node. + + :returns: The XML node + :rtype: xml.etree.ElementTree.Element + """ try: xml_map = cls._xml_map # type: ignore except AttributeError: @@ -344,7 +390,9 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) # type: ignore + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, keep_readonly=keep_readonly, **kwargs + ) def as_dict( self, @@ -378,12 +426,15 @@ def my_key_transformer(key, attr_desc, value): If you want XML serialization, you can pass the kwargs is_xml=True. + :param bool keep_readonly: If you want to serialize the readonly attributes :param function key_transformer: A key transformer function. :returns: A dict JSON compatible object :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) # type: ignore + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs + ) @classmethod def _infer_class_models(cls): @@ -393,7 +444,7 @@ def _infer_class_models(cls): client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} if cls.__name__ not in client_models: raise ValueError("Not Autorest generated code") - except Exception: + except Exception: # pylint: disable=broad-exception-caught # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. client_models = {cls.__name__: cls} return client_models @@ -406,6 +457,7 @@ def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = N :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model :raises: DeserializationError if something went wrong + :rtype: ModelType """ deserializer = Deserializer(cls._infer_class_models()) return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @@ -424,9 +476,11 @@ def from_dict( and last_rest_key_case_insensitive_extractor) :param dict data: A dict using RestAPI structure + :param function key_extractors: A key extractor function. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model :raises: DeserializationError if something went wrong + :rtype: ModelType """ deserializer = Deserializer(cls._infer_class_models()) deserializer.key_extractors = ( # type: ignore @@ -446,21 +500,25 @@ def _flatten_subtype(cls, key, objects): return {} result = dict(cls._subtype_map[key]) for valuetype in cls._subtype_map[key].values(): - result.update(objects[valuetype]._flatten_subtype(key, objects)) + result.update(objects[valuetype]._flatten_subtype(key, objects)) # pylint: disable=protected-access return result @classmethod def _classify(cls, response, objects): """Check the class _subtype_map for any child classes. We want to ignore any inherited _subtype_maps. - Remove the polymorphic key from the initial data. + + :param dict response: The initial data + :param dict objects: The class objects + :returns: The class to be used + :rtype: class """ for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): subtype_value = None if not isinstance(response, ET.Element): rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] - subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None) + subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None) else: subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) if subtype_value: @@ -499,11 +557,13 @@ def _decode_attribute_map_key(key): inside the received data. :param str key: A key string from the generated code + :returns: The decoded key + :rtype: str """ return key.replace("\\.", ".") -class Serializer(object): +class Serializer: # pylint: disable=too-many-public-methods """Request object model serializer.""" basic_types = {str: "str", int: "int", bool: "bool", float: "float"} @@ -538,7 +598,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes: Optional[Mapping[str, type]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -558,13 +618,16 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None): self.key_transformer = full_restapi_key_transformer self.client_side_validation = True - def _serialize(self, target_obj, data_type=None, **kwargs): + def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals + self, target_obj, data_type=None, **kwargs + ): """Serialize data into a string according to type. - :param target_obj: The data to be serialized. + :param object 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. + :returns: The serialized data. """ key_transformer = kwargs.get("key_transformer", self.key_transformer) keep_readonly = kwargs.get("keep_readonly", False) @@ -590,12 +653,14 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized = {} if is_xml_model_serialization: - serialized = target_obj._create_xml_node() + serialized = target_obj._create_xml_node() # pylint: disable=protected-access try: - attributes = target_obj._attribute_map + attributes = target_obj._attribute_map # pylint: disable=protected-access for attr, attr_desc in attributes.items(): attr_name = attr - if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False): + if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access + attr_name, {} + ).get("readonly", False): continue if attr_name == "additional_properties" and attr_desc["key"] == "": @@ -631,7 +696,8 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if isinstance(new_attr, list): serialized.extend(new_attr) # type: ignore 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 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 @@ -662,17 +728,17 @@ def _serialize(self, target_obj, data_type=None, **kwargs): except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) raise SerializationError(msg) from err - else: - return serialized + return serialized def body(self, data, data_type, **kwargs): """Serialize data intended for a request body. - :param data: The data to be serialized. + :param object 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 + :returns: The serialized request body """ # Just in case this is a dict @@ -701,7 +767,7 @@ def body(self, data, data_type, **kwargs): attribute_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, ] - data = deserializer._deserialize(data_type, data) + data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access except DeserializationError as err: raise SerializationError("Unable to build a model: " + str(err)) from err @@ -710,9 +776,11 @@ def body(self, 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 name: The name of the URL path parameter. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str + :returns: The serialized URL path :raises: TypeError if serialization fails. :raises: ValueError if data is None """ @@ -726,21 +794,20 @@ def url(self, name, data, data_type, **kwargs): output = output.replace("{", quote("{")).replace("}", quote("}")) else: output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return output + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + 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 name: The name of the query parameter. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :keyword bool skip_quote: Whether to skip quote the serialized result. - Defaults to False. :rtype: str, list :raises: TypeError if serialization fails. :raises: ValueError if data is None + :returns: The serialized query parameter """ try: # Treat the list aside, since we don't want to encode the div separator @@ -757,19 +824,20 @@ def query(self, name, data, data_type, **kwargs): output = str(output) else: output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return str(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + 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 name: The name of the header. + :param object 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 + :returns: The serialized header """ try: if data_type in ["[str]"]: @@ -778,21 +846,20 @@ def header(self, name, data, data_type, **kwargs): 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) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + 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 object 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. + :returns: The serialized data. + :rtype: str, int, float, bool, dict, list """ if data is None: raise ValueError("No value for given attribute") @@ -803,7 +870,7 @@ def serialize_data(self, data, data_type, **kwargs): if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) - elif data_type in self.serialize_type: + if data_type in self.serialize_type: return self.serialize_type[data_type](data, **kwargs) # If dependencies is empty, try with current data class @@ -819,11 +886,10 @@ def serialize_data(self, data, data_type, **kwargs): except (ValueError, TypeError) as err: msg = "Unable to serialize value: {!r} as type: {!r}." raise SerializationError(msg.format(data, data_type)) from err - else: - return self._serialize(data, **kwargs) + return self._serialize(data, **kwargs) @classmethod - def _get_custom_serializers(cls, data_type, **kwargs): + def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) if custom_serializer: return custom_serializer @@ -839,23 +905,26 @@ def serialize_basic(cls, data, data_type, **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 obj data: Object to be serialized. :param str data_type: Type of object in the iterable. + :rtype: str, int, float, bool + :return: serialized object """ 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 + return eval(data_type)(data) # nosec # pylint: disable=eval-used @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. + :param str data: Object to be serialized. :rtype: str + :return: serialized object """ try: # If I received an enum, return its value return data.value @@ -869,8 +938,7 @@ def serialize_unicode(cls, data): return data except NameError: return str(data) - else: - return str(data) + return str(data) def serialize_iter(self, data, iter_type, div=None, **kwargs): """Serialize iterable. @@ -880,15 +948,13 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): 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 list data: 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'. - :keyword bool do_quote: Whether to quote the serialized result of each iterable element. Defaults to False. :rtype: list, str + :return: serialized iterable """ if isinstance(data, str): raise SerializationError("Refuse str type as a valid iter type.") @@ -943,9 +1009,8 @@ def serialize_dict(self, attr, dict_type, **kwargs): :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 + :return: serialized dictionary """ serialization_ctxt = kwargs.get("serialization_ctxt", {}) serialized = {} @@ -969,7 +1034,7 @@ def serialize_dict(self, attr, dict_type, **kwargs): return serialized - def serialize_object(self, attr, **kwargs): + def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements """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 @@ -977,6 +1042,7 @@ def serialize_object(self, attr, **kwargs): :param dict attr: Object to be serialized. :rtype: dict or str + :return: serialized object """ if attr is None: return None @@ -1001,7 +1067,7 @@ def serialize_object(self, attr, **kwargs): 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): + if obj_type in self.dependencies.values() or isinstance(attr, Model): return self._serialize(attr) if obj_type == dict: @@ -1032,56 +1098,61 @@ def serialize_enum(attr, enum_obj=None): try: enum_obj(result) # type: ignore return result - except ValueError: + except ValueError as exc: for enum_value in enum_obj: # type: ignore 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)) + raise SerializationError(error.format(attr, enum_obj)) from exc @staticmethod - def serialize_bytearray(attr, **kwargs): + def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument """Serialize bytearray into base-64 string. - :param attr: Object to be serialized. + :param str attr: Object to be serialized. :rtype: str + :return: serialized base64 """ return b64encode(attr).decode() @staticmethod - def serialize_base64(attr, **kwargs): + def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument """Serialize str into base-64 string. - :param attr: Object to be serialized. + :param str attr: Object to be serialized. :rtype: str + :return: serialized base64 """ encoded = b64encode(attr).decode("ascii") return encoded.strip("=").replace("+", "-").replace("/", "_") @staticmethod - def serialize_decimal(attr, **kwargs): + def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument """Serialize Decimal object to float. - :param attr: Object to be serialized. + :param decimal attr: Object to be serialized. :rtype: float + :return: serialized decimal """ return float(attr) @staticmethod - def serialize_long(attr, **kwargs): + def serialize_long(attr, **kwargs): # pylint: disable=unused-argument """Serialize long (Py2) or int (Py3). - :param attr: Object to be serialized. + :param int attr: Object to be serialized. :rtype: int/long + :return: serialized long """ return _long_type(attr) @staticmethod - def serialize_date(attr, **kwargs): + def serialize_date(attr, **kwargs): # pylint: disable=unused-argument """Serialize Date object into ISO-8601 formatted string. :param Date attr: Object to be serialized. :rtype: str + :return: serialized date """ if isinstance(attr, str): attr = isodate.parse_date(attr) @@ -1089,11 +1160,12 @@ def serialize_date(attr, **kwargs): return t @staticmethod - def serialize_time(attr, **kwargs): + def serialize_time(attr, **kwargs): # pylint: disable=unused-argument """Serialize Time object into ISO-8601 formatted string. :param datetime.time attr: Object to be serialized. :rtype: str + :return: serialized time """ if isinstance(attr, str): attr = isodate.parse_time(attr) @@ -1103,30 +1175,32 @@ def serialize_time(attr, **kwargs): return t @staticmethod - def serialize_duration(attr, **kwargs): + def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument """Serialize TimeDelta object into ISO-8601 formatted string. :param TimeDelta attr: Object to be serialized. :rtype: str + :return: serialized duration """ if isinstance(attr, str): attr = isodate.parse_duration(attr) return isodate.duration_isoformat(attr) @staticmethod - def serialize_rfc(attr, **kwargs): + def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into RFC-1123 formatted string. :param Datetime attr: Object to be serialized. :rtype: str :raises: TypeError if format invalid. + :return: serialized rfc """ 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.") + except AttributeError as exc: + raise TypeError("RFC1123 object must be valid Datetime object.") from exc return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( Serializer.days[utc.tm_wday], @@ -1139,12 +1213,13 @@ def serialize_rfc(attr, **kwargs): ) @staticmethod - def serialize_iso(attr, **kwargs): + def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into ISO-8601 formatted string. :param Datetime attr: Object to be serialized. :rtype: str :raises: SerializationError if format invalid. + :return: serialized iso """ if isinstance(attr, str): attr = isodate.parse_datetime(attr) @@ -1170,13 +1245,14 @@ def serialize_iso(attr, **kwargs): raise TypeError(msg) from err @staticmethod - def serialize_unix(attr, **kwargs): + def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument """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 + :return: serialied unix """ if isinstance(attr, int): return attr @@ -1184,11 +1260,11 @@ def serialize_unix(attr, **kwargs): 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.") + except AttributeError as exc: + raise TypeError("Unix time object must be valid Datetime object.") from exc -def rest_key_extractor(attr, attr_desc, data): +def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument key = attr_desc["key"] working_data = data @@ -1209,7 +1285,9 @@ def rest_key_extractor(attr, attr_desc, data): return working_data.get(key) -def rest_key_case_insensitive_extractor(attr, attr_desc, data): +def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements + attr, attr_desc, data +): key = attr_desc["key"] working_data = data @@ -1230,17 +1308,29 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, 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.""" +def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + """Extract the attribute in "data" based on the last part of the JSON path key. + + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ 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): +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument """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" + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute """ key = attr_desc["key"] dict_keys = _FLATTEN.split(key) @@ -1277,7 +1367,7 @@ def _extract_name_from_internal_type(internal_type): return xml_name -def xml_key_extractor(attr, attr_desc, data): +def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements if isinstance(data, dict): return None @@ -1329,22 +1419,21 @@ def xml_key_extractor(attr, attr_desc, data): if is_iter_type: if is_wrapped: return None # is_wrapped no node, we want None - else: - return [] # not wrapped, assume empty list + 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 - ) + # 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( # pylint: disable=line-too-long + xml_name ) - return list(children[0]) # Might be empty list and that's ok. + ) + 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: @@ -1352,7 +1441,7 @@ def xml_key_extractor(attr, attr_desc, data): return children[0] -class Deserializer(object): +class Deserializer: """Response object model deserializer. :param dict classes: Class type dictionary for deserializing complex types. @@ -1361,9 +1450,9 @@ class Deserializer(object): 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}]?") + valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes: Optional[Mapping[str, type]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1401,11 +1490,12 @@ def __call__(self, target_obj, response_data, content_type=None): :param str content_type: Swagger "produces" if available. :raises: DeserializationError if deserialization fails. :return: Deserialized object. + :rtype: object """ data = self._unpack_content(response_data, content_type) return self._deserialize(target_obj, data) - def _deserialize(self, target_obj, data): + def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements """Call the deserializer on a model. Data needs to be already deserialized as JSON or XML ElementTree @@ -1414,12 +1504,13 @@ def _deserialize(self, target_obj, data): :param object data: Object to deserialize. :raises: DeserializationError if deserialization fails. :return: Deserialized object. + :rtype: 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(): + for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access if attr in constants: continue value = getattr(data, attr) @@ -1438,13 +1529,13 @@ def _deserialize(self, target_obj, data): if isinstance(response, str): return self.deserialize_data(data, response) - elif isinstance(response, type) and issubclass(response, Enum): + if isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) - if data is None: + if data is None or data is CoreNull: return data try: - attributes = response._attribute_map # type: ignore + attributes = response._attribute_map # type: ignore # pylint: disable=protected-access d_attrs = {} for attr, attr_desc in attributes.items(): # Check empty string. If it's not empty, someone has a real "additionalProperties"... @@ -1474,9 +1565,8 @@ def _deserialize(self, target_obj, data): except (AttributeError, TypeError, KeyError) as err: msg = "Unable to deserialize to object: " + class_name # type: ignore raise DeserializationError(msg) from err - else: - additional_properties = self._build_additional_properties(attributes, data) - return self._instantiate_model(response, d_attrs, additional_properties) + 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: @@ -1503,6 +1593,8 @@ def _classify_target(self, target, data): :param str target: The target object type to deserialize to. :param str/dict data: The response data to deserialize. + :return: The classified target object and its class name. + :rtype: tuple """ if target is None: return None, None @@ -1514,7 +1606,7 @@ def _classify_target(self, target, data): return target, target try: - target = target._classify(data, self.dependencies) # type: ignore + target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access except AttributeError: pass # Target is not a Model, no classify return target, target.__class__.__name__ # type: ignore @@ -1529,10 +1621,12 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): :param str target_obj: The target object type to deserialize to. :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. + :return: Deserialized object. + :rtype: object """ try: return self(target_obj, data, content_type=content_type) - except: + except: # pylint: disable=bare-except _LOGGER.debug( "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True ) @@ -1550,10 +1644,12 @@ def _unpack_content(raw_data, content_type=None): 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. + :param obj raw_data: Data to be processed. + :param str 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 + :rtype: object + :return: Unpacked content. """ # Assume this is enough to detect a Pipeline Response without importing it context = getattr(raw_data, "context", {}) @@ -1577,24 +1673,35 @@ def _unpack_content(raw_data, content_type=None): 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. + :param Response response: The response model class. + :param dict attrs: The deserialized response attributes. + :param dict additional_properties: Additional properties to be set. + :rtype: Response + :return: The instantiated response model. """ 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")] + readonly = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("readonly") + ] + const = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + 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 + response_obj.additional_properties = additional_properties # type: ignore return response_obj except TypeError as err: msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore - raise DeserializationError(msg + str(err)) + raise DeserializationError(msg + str(err)) from err else: try: for attr, value in attrs.items(): @@ -1603,15 +1710,16 @@ def _instantiate_model(self, response, attrs, additional_properties=None): except Exception as exp: msg = "Unable to populate response model. " msg += "Type: {}, Error: {}".format(type(response), exp) - raise DeserializationError(msg) + raise DeserializationError(msg) from exp - def deserialize_data(self, data, data_type): + def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements """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. + :rtype: object """ if data is None: return data @@ -1625,7 +1733,11 @@ def deserialize_data(self, data, data_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"{}"] + is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment + "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) @@ -1645,14 +1757,14 @@ def deserialize_data(self, data, data_type): msg = "Unable to deserialize response data." msg += " Data: {}, {}".format(data, data_type) raise DeserializationError(msg) from err - else: - return self._deserialize(obj_type, data) + 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. + :return: Deserialized iterable. :rtype: list """ if attr is None: @@ -1669,6 +1781,7 @@ def deserialize_dict(self, attr, dict_type): :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. + :return: Deserialized dictionary. :rtype: dict """ if isinstance(attr, list): @@ -1679,11 +1792,12 @@ def deserialize_dict(self, attr, dict_type): 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): + def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements """Deserialize a generic object. This will be handled as a dictionary. :param dict attr: Dictionary to be deserialized. + :return: Deserialized object. :rtype: dict :raises: TypeError if non-builtin datatype encountered. """ @@ -1718,11 +1832,10 @@ def deserialize_object(self, attr, **kwargs): pass return deserialized - else: - error = "Cannot deserialize generic object with type: " - raise TypeError(error + str(obj_type)) + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) - def deserialize_basic(self, attr, data_type): + def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements """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 @@ -1730,6 +1843,7 @@ def deserialize_basic(self, attr, data_type): :param str attr: response string to be deserialized. :param str data_type: deserialization data type. + :return: Deserialized basic type. :rtype: str, int, float or bool :raises: TypeError if string format is not valid. """ @@ -1741,24 +1855,23 @@ def deserialize_basic(self, attr, data_type): 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 + # 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, str): + if isinstance(attr, str): if attr.lower() in ["true", "1"]: return True - elif attr.lower() in ["false", "0"]: + if 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 + return eval(data_type)(attr) # nosec # pylint: disable=eval-used @staticmethod def deserialize_unicode(data): @@ -1766,6 +1879,7 @@ def deserialize_unicode(data): as a string. :param str data: response string to be deserialized. + :return: Deserialized string. :rtype: str or unicode """ # We might be here because we have an enum modeled as string, @@ -1779,8 +1893,7 @@ def deserialize_unicode(data): return data except NameError: return str(data) - else: - return str(data) + return str(data) @staticmethod def deserialize_enum(data, enum_obj): @@ -1792,6 +1905,7 @@ def deserialize_enum(data, enum_obj): :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. + :return: Deserialized enum object. :rtype: Enum """ if isinstance(data, enum_obj) or data is None: @@ -1802,9 +1916,9 @@ def deserialize_enum(data, enum_obj): # Workaround. We might consider remove it in the future. try: return list(enum_obj.__members__.values())[data] - except IndexError: + except IndexError as exc: error = "{!r} is not a valid index for enum {!r}" - raise DeserializationError(error.format(data, enum_obj)) + raise DeserializationError(error.format(data, enum_obj)) from exc try: return enum_obj(str(data)) except ValueError: @@ -1820,6 +1934,7 @@ def deserialize_bytearray(attr): """Deserialize string into bytearray. :param str attr: response string to be deserialized. + :return: Deserialized bytearray :rtype: bytearray :raises: TypeError if string format invalid. """ @@ -1832,6 +1947,7 @@ def deserialize_base64(attr): """Deserialize base64 encoded string into string. :param str attr: response string to be deserialized. + :return: Deserialized base64 string :rtype: bytearray :raises: TypeError if string format invalid. """ @@ -1847,8 +1963,9 @@ def deserialize_decimal(attr): """Deserialize string into Decimal object. :param str attr: response string to be deserialized. - :rtype: Decimal + :return: Deserialized decimal :raises: DeserializationError if string format invalid. + :rtype: decimal """ if isinstance(attr, ET.Element): attr = attr.text @@ -1863,6 +1980,7 @@ def deserialize_long(attr): """Deserialize string into long (Py2) or int (Py3). :param str attr: response string to be deserialized. + :return: Deserialized int :rtype: long or int :raises: ValueError if string format invalid. """ @@ -1875,6 +1993,7 @@ def deserialize_duration(attr): """Deserialize ISO-8601 formatted string into TimeDelta object. :param str attr: response string to be deserialized. + :return: Deserialized duration :rtype: TimeDelta :raises: DeserializationError if string format invalid. """ @@ -1885,14 +2004,14 @@ def deserialize_duration(attr): except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize duration object." raise DeserializationError(msg) from err - else: - return duration + return duration @staticmethod def deserialize_date(attr): """Deserialize ISO-8601 formatted string into Date object. :param str attr: response string to be deserialized. + :return: Deserialized date :rtype: Date :raises: DeserializationError if string format invalid. """ @@ -1908,6 +2027,7 @@ def deserialize_time(attr): """Deserialize ISO-8601 formatted string into time object. :param str attr: response string to be deserialized. + :return: Deserialized time :rtype: datetime.time :raises: DeserializationError if string format invalid. """ @@ -1922,6 +2042,7 @@ def deserialize_rfc(attr): """Deserialize RFC-1123 formatted string into Datetime object. :param str attr: response string to be deserialized. + :return: Deserialized RFC datetime :rtype: Datetime :raises: DeserializationError if string format invalid. """ @@ -1937,14 +2058,14 @@ def deserialize_rfc(attr): except ValueError as err: msg = "Cannot deserialize to rfc datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj @staticmethod def deserialize_iso(attr): """Deserialize ISO-8601 formatted string into Datetime object. :param str attr: response string to be deserialized. + :return: Deserialized ISO datetime :rtype: Datetime :raises: DeserializationError if string format invalid. """ @@ -1974,8 +2095,7 @@ def deserialize_iso(attr): except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj @staticmethod def deserialize_unix(attr): @@ -1983,6 +2103,7 @@ def deserialize_unix(attr): This is represented as seconds. :param int attr: Object to be serialized. + :return: Deserialized datetime :rtype: Datetime :raises: DeserializationError if format invalid """ @@ -1994,5 +2115,4 @@ def deserialize_unix(attr): except ValueError as err: msg = "Cannot deserialize to unix datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_vendor.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_vendor.py index 1c9b3845478f..29bb43ff4a9c 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_vendor.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_vendor.py @@ -8,25 +8,14 @@ from abc import ABC from typing import TYPE_CHECKING -from azure.core.pipeline.transport import HttpRequest - from ._configuration import RecoveryServicesBackupClientConfiguration 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) - if files: - request.set_formdata_body(files) - return request - - class RecoveryServicesBackupClientMixinABC(ABC): """DO NOT use this class. It is for internal typing use only.""" diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_version.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_version.py index f89ed38360ab..e5754a47ce68 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_version.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "9.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/__init__.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/__init__.py index 8e5f383e6ee4..53250d84c9b1 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/__init__.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/__init__.py @@ -5,12 +5,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._recovery_services_backup_client import RecoveryServicesBackupClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._recovery_services_backup_client import RecoveryServicesBackupClient # type: ignore try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -18,6 +24,6 @@ __all__ = [ "RecoveryServicesBackupClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/_configuration.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/_configuration.py index 145656e3c12b..a6d0a1e80590 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/_configuration.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/_configuration.py @@ -14,7 +14,6 @@ from .._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/_recovery_services_backup_client.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/_recovery_services_backup_client.py index 323c1eebd797..ebbf39edacd3 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/_recovery_services_backup_client.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/_recovery_services_backup_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -74,13 +75,12 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential class RecoveryServicesBackupClient( RecoveryServicesBackupClientOperationsMixin -): # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +): # pylint: disable=too-many-instance-attributes """Open API 2.0 Specs for Azure RecoveryServices Backup service. :ivar backup_resource_storage_configs_non_crr: BackupResourceStorageConfigsNonCRROperations @@ -447,7 +447,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "RecoveryServicesBackupClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/_vendor.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/_vendor.py index 1da41c8befcd..59f8ee276e9a 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/_vendor.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/_vendor.py @@ -8,12 +8,9 @@ from abc import ABC from typing import TYPE_CHECKING -from azure.core.pipeline.transport import HttpRequest - from ._configuration import RecoveryServicesBackupClientConfiguration if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core import AsyncPipelineClient from .._serialization import Deserializer, Serializer diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/__init__.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/__init__.py index 29071c5cf960..634b1b06bf96 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/__init__.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/__init__.py @@ -5,65 +5,69 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._backup_resource_storage_configs_non_crr_operations import BackupResourceStorageConfigsNonCRROperations -from ._protection_intent_operations import ProtectionIntentOperations -from ._backup_status_operations import BackupStatusOperations -from ._feature_support_operations import FeatureSupportOperations -from ._backup_protection_intent_operations import BackupProtectionIntentOperations -from ._backup_usage_summaries_operations import BackupUsageSummariesOperations -from ._operations import Operations -from ._backup_resource_vault_configs_operations import BackupResourceVaultConfigsOperations -from ._backup_resource_encryption_configs_operations import BackupResourceEncryptionConfigsOperations -from ._private_endpoint_connection_operations import PrivateEndpointConnectionOperations -from ._private_endpoint_operations import PrivateEndpointOperations -from ._recovery_services_backup_client_operations import RecoveryServicesBackupClientOperationsMixin -from ._bms_prepare_data_move_operation_result_operations import BMSPrepareDataMoveOperationResultOperations -from ._protected_items_operations import ProtectedItemsOperations -from ._protected_item_operation_results_operations import ProtectedItemOperationResultsOperations -from ._recovery_points_operations import RecoveryPointsOperations -from ._restores_operations import RestoresOperations -from ._backup_policies_operations import BackupPoliciesOperations -from ._protection_policies_operations import ProtectionPoliciesOperations -from ._protection_policy_operation_results_operations import ProtectionPolicyOperationResultsOperations -from ._backup_jobs_operations import BackupJobsOperations -from ._job_details_operations import JobDetailsOperations -from ._job_cancellations_operations import JobCancellationsOperations -from ._job_operation_results_operations import JobOperationResultsOperations -from ._export_jobs_operation_results_operations import ExportJobsOperationResultsOperations -from ._jobs_operations import JobsOperations -from ._backup_protected_items_operations import BackupProtectedItemsOperations -from ._operation_operations import OperationOperations -from ._validate_operation_operations import ValidateOperationOperations -from ._validate_operation_results_operations import ValidateOperationResultsOperations -from ._validate_operation_statuses_operations import ValidateOperationStatusesOperations -from ._backup_engines_operations import BackupEnginesOperations -from ._protection_container_refresh_operation_results_operations import ( - ProtectionContainerRefreshOperationResultsOperations, -) -from ._protectable_containers_operations import ProtectableContainersOperations -from ._protection_containers_operations import ProtectionContainersOperations -from ._backup_workload_items_operations import BackupWorkloadItemsOperations -from ._protection_container_operation_results_operations import ProtectionContainerOperationResultsOperations -from ._backups_operations import BackupsOperations -from ._protected_item_operation_statuses_operations import ProtectedItemOperationStatusesOperations -from ._item_level_recovery_connections_operations import ItemLevelRecoveryConnectionsOperations -from ._backup_operation_results_operations import BackupOperationResultsOperations -from ._backup_operation_statuses_operations import BackupOperationStatusesOperations -from ._protection_policy_operation_statuses_operations import ProtectionPolicyOperationStatusesOperations -from ._backup_protectable_items_operations import BackupProtectableItemsOperations -from ._backup_protection_containers_operations import BackupProtectionContainersOperations -from ._deleted_protection_containers_operations import DeletedProtectionContainersOperations -from ._security_pins_operations import SecurityPINsOperations -from ._recovery_points_recommended_for_move_operations import RecoveryPointsRecommendedForMoveOperations -from ._resource_guard_proxies_operations import ResourceGuardProxiesOperations -from ._resource_guard_proxy_operations import ResourceGuardProxyOperations -from ._fetch_tiering_cost_operations import FetchTieringCostOperations -from ._get_tiering_cost_operation_result_operations import GetTieringCostOperationResultOperations -from ._tiering_cost_operation_status_operations import TieringCostOperationStatusOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._backup_resource_storage_configs_non_crr_operations import BackupResourceStorageConfigsNonCRROperations # type: ignore +from ._protection_intent_operations import ProtectionIntentOperations # type: ignore +from ._backup_status_operations import BackupStatusOperations # type: ignore +from ._feature_support_operations import FeatureSupportOperations # type: ignore +from ._backup_protection_intent_operations import BackupProtectionIntentOperations # type: ignore +from ._backup_usage_summaries_operations import BackupUsageSummariesOperations # type: ignore +from ._operations import Operations # type: ignore +from ._backup_resource_vault_configs_operations import BackupResourceVaultConfigsOperations # type: ignore +from ._backup_resource_encryption_configs_operations import BackupResourceEncryptionConfigsOperations # type: ignore +from ._private_endpoint_connection_operations import PrivateEndpointConnectionOperations # type: ignore +from ._private_endpoint_operations import PrivateEndpointOperations # type: ignore +from ._recovery_services_backup_client_operations import RecoveryServicesBackupClientOperationsMixin # type: ignore +from ._bms_prepare_data_move_operation_result_operations import BMSPrepareDataMoveOperationResultOperations # type: ignore +from ._protected_items_operations import ProtectedItemsOperations # type: ignore +from ._protected_item_operation_results_operations import ProtectedItemOperationResultsOperations # type: ignore +from ._recovery_points_operations import RecoveryPointsOperations # type: ignore +from ._restores_operations import RestoresOperations # type: ignore +from ._backup_policies_operations import BackupPoliciesOperations # type: ignore +from ._protection_policies_operations import ProtectionPoliciesOperations # type: ignore +from ._protection_policy_operation_results_operations import ProtectionPolicyOperationResultsOperations # type: ignore +from ._backup_jobs_operations import BackupJobsOperations # type: ignore +from ._job_details_operations import JobDetailsOperations # type: ignore +from ._job_cancellations_operations import JobCancellationsOperations # type: ignore +from ._job_operation_results_operations import JobOperationResultsOperations # type: ignore +from ._export_jobs_operation_results_operations import ExportJobsOperationResultsOperations # type: ignore +from ._jobs_operations import JobsOperations # type: ignore +from ._backup_protected_items_operations import BackupProtectedItemsOperations # type: ignore +from ._operation_operations import OperationOperations # type: ignore +from ._validate_operation_operations import ValidateOperationOperations # type: ignore +from ._validate_operation_results_operations import ValidateOperationResultsOperations # type: ignore +from ._validate_operation_statuses_operations import ValidateOperationStatusesOperations # type: ignore +from ._backup_engines_operations import BackupEnginesOperations # type: ignore +from ._protection_container_refresh_operation_results_operations import ProtectionContainerRefreshOperationResultsOperations # type: ignore +from ._protectable_containers_operations import ProtectableContainersOperations # type: ignore +from ._protection_containers_operations import ProtectionContainersOperations # type: ignore +from ._backup_workload_items_operations import BackupWorkloadItemsOperations # type: ignore +from ._protection_container_operation_results_operations import ProtectionContainerOperationResultsOperations # type: ignore +from ._backups_operations import BackupsOperations # type: ignore +from ._protected_item_operation_statuses_operations import ProtectedItemOperationStatusesOperations # type: ignore +from ._item_level_recovery_connections_operations import ItemLevelRecoveryConnectionsOperations # type: ignore +from ._backup_operation_results_operations import BackupOperationResultsOperations # type: ignore +from ._backup_operation_statuses_operations import BackupOperationStatusesOperations # type: ignore +from ._protection_policy_operation_statuses_operations import ProtectionPolicyOperationStatusesOperations # type: ignore +from ._backup_protectable_items_operations import BackupProtectableItemsOperations # type: ignore +from ._backup_protection_containers_operations import BackupProtectionContainersOperations # type: ignore +from ._deleted_protection_containers_operations import DeletedProtectionContainersOperations # type: ignore +from ._security_pins_operations import SecurityPINsOperations # type: ignore +from ._recovery_points_recommended_for_move_operations import RecoveryPointsRecommendedForMoveOperations # type: ignore +from ._resource_guard_proxies_operations import ResourceGuardProxiesOperations # type: ignore +from ._resource_guard_proxy_operations import ResourceGuardProxyOperations # type: ignore +from ._fetch_tiering_cost_operations import FetchTieringCostOperations # type: ignore +from ._get_tiering_cost_operation_result_operations import GetTieringCostOperationResultOperations # type: ignore +from ._tiering_cost_operation_status_operations import TieringCostOperationStatusOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -121,5 +125,5 @@ "GetTieringCostOperationResultOperations", "TieringCostOperationStatusOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_engines_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_engines_operations.py index 8abf219dde77..6d88d30d154b 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_engines_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_engines_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -19,18 +19,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._backup_engines_operations import build_get_request, build_list_request -from .._vendor import RecoveryServicesBackupClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -63,6 +64,7 @@ def list( skip_token: Optional[str] = None, **kwargs: Any ) -> AsyncIterable["_models.BackupEngineBaseResource"]: + # pylint: disable=line-too-long """Backup management servers registered to Recovery Services Vault. Returns a pageable list of servers. @@ -87,7 +89,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BackupEngineBaseResourceList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -108,7 +110,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -124,7 +125,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -180,7 +180,7 @@ async def get( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupEngineBaseResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -205,7 +205,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -219,7 +218,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupEngineBaseResource", pipeline_response) + deserialized = self._deserialize("BackupEngineBaseResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_jobs_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_jobs_operations.py index b2cb4a1ecee7..c8fd662cc590 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_jobs_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_jobs_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -19,17 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 from ...operations._backup_jobs_operations import build_list_request -from .._vendor import RecoveryServicesBackupClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -84,7 +85,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -105,7 +106,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -121,7 +121,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_operation_results_operations.py index 061e0e273ed5..5ab0576eda71 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_operation_results_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -17,17 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest 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._backup_operation_results_operations import build_get_request -from .._vendor import RecoveryServicesBackupClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -52,9 +53,7 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def get( # pylint: disable=inconsistent-return-statements - self, vault_name: str, resource_group_name: str, operation_id: str, **kwargs: Any - ) -> None: + async def get(self, vault_name: str, resource_group_name: str, operation_id: str, **kwargs: Any) -> None: """Provides the status of the delete operations such as deleting backed up item. Once the operation has started, the status code in the response would be Accepted. It will continue to be in this state till it @@ -74,7 +73,7 @@ async def get( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -97,7 +96,6 @@ async def get( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_operation_statuses_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_operation_statuses_operations.py index dffc6f1d7baf..3f5ce46fc877 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_operation_statuses_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_operation_statuses_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -17,17 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest 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._backup_operation_statuses_operations import build_get_request -from .._vendor import RecoveryServicesBackupClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -72,7 +73,7 @@ async def get( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.OperationStatus :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -95,7 +96,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -109,7 +109,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("OperationStatus", pipeline_response) + deserialized = self._deserialize("OperationStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_policies_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_policies_operations.py index e5766b110dac..d0a13fa7ffbd 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_policies_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -19,17 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 from ...operations._backup_policies_operations import build_list_request -from .._vendor import RecoveryServicesBackupClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -57,6 +58,7 @@ def __init__(self, *args, **kwargs) -> None: def list( self, vault_name: str, resource_group_name: str, filter: Optional[str] = None, **kwargs: Any ) -> AsyncIterable["_models.ProtectionPolicyResource"]: + # pylint: disable=line-too-long """Lists of backup policies associated with Recovery Services Vault. API provides pagination parameters to fetch scoped results. @@ -80,7 +82,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ProtectionPolicyResourceList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -100,7 +102,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -116,7 +117,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protectable_items_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protectable_items_operations.py index db12ab535554..64f210822a31 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protectable_items_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protectable_items_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -19,17 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 from ...operations._backup_protectable_items_operations import build_list_request -from .._vendor import RecoveryServicesBackupClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -62,6 +63,7 @@ def list( skip_token: Optional[str] = None, **kwargs: Any ) -> AsyncIterable["_models.WorkloadProtectableItemResource"]: + # pylint: disable=line-too-long """Provides a pageable list of protectable objects within your subscription according to the query filter and the pagination parameters. @@ -87,7 +89,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.WorkloadProtectableItemResourceList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -108,7 +110,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -124,7 +125,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protected_items_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protected_items_operations.py index 4fd9a550625f..2778e144daa6 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protected_items_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protected_items_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -19,17 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 from ...operations._backup_protected_items_operations import build_list_request -from .._vendor import RecoveryServicesBackupClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -62,6 +63,7 @@ def list( skip_token: Optional[str] = None, **kwargs: Any ) -> AsyncIterable["_models.ProtectedItemResource"]: + # pylint: disable=line-too-long """Provides a pageable list of all items that are backed up within a vault. :param vault_name: The name of the recovery services vault. Required. @@ -85,7 +87,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ProtectedItemResourceList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -106,7 +108,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -122,7 +123,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protection_containers_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protection_containers_operations.py index 6b5454195f0b..9e6cdd6c80bf 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protection_containers_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protection_containers_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -19,17 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 from ...operations._backup_protection_containers_operations import build_list_request -from .._vendor import RecoveryServicesBackupClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -57,6 +58,7 @@ def __init__(self, *args, **kwargs) -> None: def list( self, vault_name: str, resource_group_name: str, filter: Optional[str] = None, **kwargs: Any ) -> AsyncIterable["_models.ProtectionContainerResource"]: + # pylint: disable=line-too-long """Lists the containers registered to Recovery Services Vault. :param vault_name: The name of the recovery services vault. Required. @@ -78,7 +80,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ProtectionContainerResourceList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -98,7 +100,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -114,7 +115,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protection_intent_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protection_intent_operations.py index ae8387afe465..1601071b8ec8 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protection_intent_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protection_intent_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -19,17 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 from ...operations._backup_protection_intent_operations import build_list_request -from .._vendor import RecoveryServicesBackupClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -62,6 +63,7 @@ def list( skip_token: Optional[str] = None, **kwargs: Any ) -> AsyncIterable["_models.ProtectionIntentResource"]: + # pylint: disable=line-too-long """Provides a pageable list of all intents that are present within a vault. :param vault_name: The name of the recovery services vault. Required. @@ -85,7 +87,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ProtectionIntentResourceList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -106,7 +108,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -122,7 +123,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_resource_encryption_configs_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_resource_encryption_configs_operations.py index 48ab1898e1e1..3cb3f81e0c73 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_resource_encryption_configs_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_resource_encryption_configs_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -18,17 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest 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._backup_resource_encryption_configs_operations import build_get_request, build_update_request -from .._vendor import RecoveryServicesBackupClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -68,7 +69,7 @@ async def get( ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceEncryptionConfigExtendedResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -90,7 +91,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -105,7 +105,9 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupResourceEncryptionConfigExtendedResource", pipeline_response) + deserialized = self._deserialize( + "BackupResourceEncryptionConfigExtendedResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -113,7 +115,7 @@ async def get( return deserialized # type: ignore @overload - async def update( # pylint: disable=inconsistent-return-statements + async def update( self, vault_name: str, resource_group_name: str, @@ -141,7 +143,7 @@ async def update( # pylint: disable=inconsistent-return-statements """ @overload - async def update( # pylint: disable=inconsistent-return-statements + async def update( self, vault_name: str, resource_group_name: str, @@ -168,7 +170,7 @@ async def update( # pylint: disable=inconsistent-return-statements """ @distributed_trace_async - async def update( # pylint: disable=inconsistent-return-statements + async def update( self, vault_name: str, resource_group_name: str, @@ -191,7 +193,7 @@ async def update( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -225,7 +227,6 @@ async def update( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_resource_storage_configs_non_crr_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_resource_storage_configs_non_crr_operations.py index 83fb6ba12ad1..f2f462cc59ad 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_resource_storage_configs_non_crr_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_resource_storage_configs_non_crr_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -18,21 +18,22 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest 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._backup_resource_storage_configs_non_crr_operations import ( build_get_request, build_patch_request, build_update_request, ) -from .._vendor import RecoveryServicesBackupClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,7 +72,7 @@ async def get( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceConfigResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -93,7 +94,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -108,7 +108,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupResourceConfigResource", pipeline_response) + deserialized = self._deserialize("BackupResourceConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -193,7 +193,7 @@ async def update( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceConfigResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -227,7 +227,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -242,7 +241,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupResourceConfigResource", pipeline_response) + deserialized = self._deserialize("BackupResourceConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -250,7 +249,7 @@ async def update( return deserialized # type: ignore @overload - async def patch( # pylint: disable=inconsistent-return-statements + async def patch( self, vault_name: str, resource_group_name: str, @@ -278,7 +277,7 @@ async def patch( # pylint: disable=inconsistent-return-statements """ @overload - async def patch( # pylint: disable=inconsistent-return-statements + async def patch( self, vault_name: str, resource_group_name: str, @@ -305,7 +304,7 @@ async def patch( # pylint: disable=inconsistent-return-statements """ @distributed_trace_async - async def patch( # pylint: disable=inconsistent-return-statements + async def patch( self, vault_name: str, resource_group_name: str, @@ -327,7 +326,7 @@ async def patch( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -361,7 +360,6 @@ async def patch( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_resource_vault_configs_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_resource_vault_configs_operations.py index 5cdcd5ab80ae..974c6dc562f6 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_resource_vault_configs_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_resource_vault_configs_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -18,21 +18,22 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest 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._backup_resource_vault_configs_operations import ( build_get_request, build_put_request, build_update_request, ) -from .._vendor import RecoveryServicesBackupClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,7 +72,7 @@ async def get( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceVaultConfigResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -93,7 +94,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -108,7 +108,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupResourceVaultConfigResource", pipeline_response) + deserialized = self._deserialize("BackupResourceVaultConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -203,7 +203,7 @@ async def update( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceVaultConfigResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -238,7 +238,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -253,7 +252,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupResourceVaultConfigResource", pipeline_response) + deserialized = self._deserialize("BackupResourceVaultConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -348,7 +347,7 @@ async def put( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceVaultConfigResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -383,7 +382,6 @@ async def put( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -398,7 +396,7 @@ async def put( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupResourceVaultConfigResource", pipeline_response) + deserialized = self._deserialize("BackupResourceVaultConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_status_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_status_operations.py index b0aed943760b..7535ee25a96d 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_status_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_status_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -18,17 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest 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._backup_status_operations import build_get_request -from .._vendor import RecoveryServicesBackupClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -115,7 +116,7 @@ async def get( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupStatusResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -148,7 +149,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -162,7 +162,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupStatusResponse", pipeline_response) + deserialized = self._deserialize("BackupStatusResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_usage_summaries_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_usage_summaries_operations.py index 17a10fa2bce0..06af73933a4b 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_usage_summaries_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_usage_summaries_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -19,17 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 from ...operations._backup_usage_summaries_operations import build_list_request -from .._vendor import RecoveryServicesBackupClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -62,6 +63,7 @@ def list( skip_token: Optional[str] = None, **kwargs: Any ) -> AsyncIterable["_models.BackupManagementUsage"]: + # pylint: disable=line-too-long """Fetches the backup management usage summaries of the vault. :param vault_name: The name of the recovery services vault. Required. @@ -85,7 +87,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BackupManagementUsageList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -106,7 +108,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -122,7 +123,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_workload_items_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_workload_items_operations.py index f71b9449b14d..0a562e27881e 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_workload_items_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_workload_items_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -19,17 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 from ...operations._backup_workload_items_operations import build_list_request -from .._vendor import RecoveryServicesBackupClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +65,7 @@ def list( skip_token: Optional[str] = None, **kwargs: Any ) -> AsyncIterable["_models.WorkloadItemResource"]: + # pylint: disable=line-too-long """Provides a pageable list of workload item of a specific container according to the query filter and the pagination parameters. @@ -93,7 +95,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.WorkloadItemResourceList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -116,7 +118,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -132,7 +133,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backups_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backups_operations.py index be67d92850fb..11f5b787862a 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backups_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backups_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -18,17 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest 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._backups_operations import build_trigger_request -from .._vendor import RecoveryServicesBackupClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +54,7 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @overload - async def trigger( # pylint: disable=inconsistent-return-statements + async def trigger( self, vault_name: str, resource_group_name: str, @@ -91,7 +92,7 @@ async def trigger( # pylint: disable=inconsistent-return-statements """ @overload - async def trigger( # pylint: disable=inconsistent-return-statements + async def trigger( self, vault_name: str, resource_group_name: str, @@ -129,7 +130,7 @@ async def trigger( # pylint: disable=inconsistent-return-statements """ @distributed_trace_async - async def trigger( # pylint: disable=inconsistent-return-statements + async def trigger( self, vault_name: str, resource_group_name: str, @@ -162,7 +163,7 @@ async def trigger( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -199,7 +200,6 @@ async def trigger( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_bms_prepare_data_move_operation_result_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_bms_prepare_data_move_operation_result_operations.py index e126b7d7a4da..473ff0463ab5 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_bms_prepare_data_move_operation_result_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_bms_prepare_data_move_operation_result_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -17,17 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest 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._bms_prepare_data_move_operation_result_operations import build_get_request -from .._vendor import RecoveryServicesBackupClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,7 +71,7 @@ async def get( or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -93,7 +94,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -110,7 +110,9 @@ async def get( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VaultStorageConfigOperationResultResponse", pipeline_response) + deserialized = self._deserialize( + "VaultStorageConfigOperationResultResponse", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_deleted_protection_containers_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_deleted_protection_containers_operations.py index 4473e931d749..7b33051d3a1d 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_deleted_protection_containers_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_deleted_protection_containers_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -19,17 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 from ...operations._deleted_protection_containers_operations import build_list_request -from .._vendor import RecoveryServicesBackupClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -57,6 +58,7 @@ def __init__(self, *args, **kwargs) -> None: def list( self, resource_group_name: str, vault_name: str, filter: Optional[str] = None, **kwargs: Any ) -> AsyncIterable["_models.ProtectionContainerResource"]: + # pylint: disable=line-too-long """Lists the soft deleted containers registered to Recovery Services Vault. :param resource_group_name: The name of the resource group where the recovery services vault is @@ -78,7 +80,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ProtectionContainerResourceList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -98,7 +100,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -114,7 +115,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_export_jobs_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_export_jobs_operation_results_operations.py index 474dc4832437..7cfa9fa0c171 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_export_jobs_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_export_jobs_operation_results_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -17,17 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest 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._export_jobs_operation_results_operations import build_get_request -from .._vendor import RecoveryServicesBackupClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,7 +72,7 @@ async def get( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.OperationResultInfoBaseResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -94,7 +95,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -108,11 +108,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("OperationResultInfoBaseResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("OperationResultInfoBaseResource", pipeline_response) + deserialized = self._deserialize("OperationResultInfoBaseResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_feature_support_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_feature_support_operations.py index dcebcc0215e9..fbba812cae2e 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_feature_support_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_feature_support_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -18,17 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest 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._feature_support_operations import build_validate_request -from .._vendor import RecoveryServicesBackupClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -118,7 +119,7 @@ async def validate( ~azure.mgmt.recoveryservicesbackup.activestamp.models.AzureVMResourceFeatureSupportResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -151,7 +152,6 @@ async def validate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -165,7 +165,7 @@ async def validate( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureVMResourceFeatureSupportResponse", pipeline_response) + deserialized = self._deserialize("AzureVMResourceFeatureSupportResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_fetch_tiering_cost_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_fetch_tiering_cost_operations.py index d14e77b38b33..2de5aa789481 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_fetch_tiering_cost_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_fetch_tiering_cost_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,22 +15,25 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest 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 azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._fetch_tiering_cost_operations import build_post_request -from .._vendor import RecoveryServicesBackupClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -60,8 +63,8 @@ async def _post_initial( vault_name: str, parameters: Union[_models.FetchTieringCostInfoRequest, IO[bytes]], **kwargs: Any - ) -> Optional[_models.TieringCostInfo]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -74,7 +77,7 @@ async def _post_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.TieringCostInfo]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -95,10 +98,10 @@ async def _post_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -106,17 +109,19 @@ async def _post_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("TieringCostInfo", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -233,10 +238,11 @@ async def begin_post( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("TieringCostInfo", pipeline_response) + deserialized = self._deserialize("TieringCostInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_get_tiering_cost_operation_result_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_get_tiering_cost_operation_result_operations.py index ebb352f30db1..0751e7bb8241 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_get_tiering_cost_operation_result_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_get_tiering_cost_operation_result_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -17,17 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest 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._get_tiering_cost_operation_result_operations import build_get_request -from .._vendor import RecoveryServicesBackupClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -68,7 +69,7 @@ async def get( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.TieringCostInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -91,7 +92,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -105,7 +105,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TieringCostInfo", pipeline_response) + deserialized = self._deserialize("TieringCostInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_item_level_recovery_connections_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_item_level_recovery_connections_operations.py index bb4753006bbb..4b12d932eab9 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_item_level_recovery_connections_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_item_level_recovery_connections_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -18,17 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest 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._item_level_recovery_connections_operations import build_provision_request, build_revoke_request -from .._vendor import RecoveryServicesBackupClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +54,7 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @overload - async def provision( # pylint: disable=inconsistent-return-statements + async def provision( self, vault_name: str, resource_group_name: str, @@ -99,7 +100,7 @@ async def provision( # pylint: disable=inconsistent-return-statements """ @overload - async def provision( # pylint: disable=inconsistent-return-statements + async def provision( self, vault_name: str, resource_group_name: str, @@ -145,7 +146,7 @@ async def provision( # pylint: disable=inconsistent-return-statements """ @distributed_trace_async - async def provision( # pylint: disable=inconsistent-return-statements + async def provision( self, vault_name: str, resource_group_name: str, @@ -186,7 +187,7 @@ async def provision( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -224,7 +225,6 @@ async def provision( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -242,7 +242,7 @@ async def provision( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async - async def revoke( # pylint: disable=inconsistent-return-statements + async def revoke( self, vault_name: str, resource_group_name: str, @@ -276,7 +276,7 @@ async def revoke( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -302,7 +302,6 @@ async def revoke( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_job_cancellations_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_job_cancellations_operations.py index 41acaa2f7231..57d6378ac314 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_job_cancellations_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_job_cancellations_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -17,17 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest 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._job_cancellations_operations import build_trigger_request -from .._vendor import RecoveryServicesBackupClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -52,9 +53,7 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def trigger( # pylint: disable=inconsistent-return-statements - self, vault_name: str, resource_group_name: str, job_name: str, **kwargs: Any - ) -> None: + async def trigger(self, vault_name: str, resource_group_name: str, job_name: str, **kwargs: Any) -> None: """Cancels a job. This is an asynchronous operation. To know the status of the cancellation, call GetCancelOperationResult API. @@ -69,7 +68,7 @@ async def trigger( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -92,7 +91,6 @@ async def trigger( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_job_details_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_job_details_operations.py index cabd773f0966..a67e01a791aa 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_job_details_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_job_details_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -17,17 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest 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._job_details_operations import build_get_request -from .._vendor import RecoveryServicesBackupClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -66,7 +67,7 @@ async def get(self, vault_name: str, resource_group_name: str, job_name: str, ** :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.JobResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -89,7 +90,6 @@ async def get(self, vault_name: str, resource_group_name: str, job_name: str, ** headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -103,7 +103,7 @@ async def get(self, vault_name: str, resource_group_name: str, job_name: str, ** map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("JobResource", pipeline_response) + deserialized = self._deserialize("JobResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_job_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_job_operation_results_operations.py index 02e057bbe6cb..01e9344b5f2b 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_job_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_job_operation_results_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -17,17 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest 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._job_operation_results_operations import build_get_request -from .._vendor import RecoveryServicesBackupClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -52,7 +53,7 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def get( # pylint: disable=inconsistent-return-statements + async def get( self, vault_name: str, resource_group_name: str, job_name: str, operation_id: str, **kwargs: Any ) -> None: """Fetches the result of any operation. @@ -71,7 +72,7 @@ async def get( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -95,7 +96,6 @@ async def get( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_jobs_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_jobs_operations.py index 2d9b7eb9ea49..bf20feffe451 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_jobs_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_jobs_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -17,17 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest 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._jobs_operations import build_export_request -from .._vendor import RecoveryServicesBackupClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -52,7 +53,7 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def export( # pylint: disable=inconsistent-return-statements + async def export( self, vault_name: str, resource_group_name: str, filter: Optional[str] = None, **kwargs: Any ) -> None: """Triggers export of jobs specified by filters and returns an OperationID to track. @@ -68,7 +69,7 @@ async def export( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -91,7 +92,6 @@ async def export( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_operation_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_operation_operations.py index b1881bc8f484..6f3267a50b41 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_operation_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_operation_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -18,17 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest 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._operation_operations import build_validate_request -from .._vendor import RecoveryServicesBackupClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -131,7 +132,7 @@ async def validate( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ValidateOperationsResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -165,7 +166,6 @@ async def validate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -179,7 +179,7 @@ async def validate( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ValidateOperationsResponse", pipeline_response) + deserialized = self._deserialize("ValidateOperationsResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_operations.py index d8275b973377..a93da553f769 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -19,17 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 from ...operations._operations import build_list_request -from .._vendor import RecoveryServicesBackupClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,6 +56,7 @@ def __init__(self, *args, **kwargs) -> None: @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.ClientDiscoveryValueForSingleApi"]: + # pylint: disable=line-too-long """Returns the list of available operations. :return: An iterator like instance of either ClientDiscoveryValueForSingleApi or the result of @@ -69,7 +71,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ClientDiscoveryValueForS api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ClientDiscoveryResponse] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -85,7 +87,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -101,7 +102,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_private_endpoint_connection_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_private_endpoint_connection_operations.py index 589de026ce3c..8b5561c1b969 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_private_endpoint_connection_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_private_endpoint_connection_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,26 +15,29 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest 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 azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._private_endpoint_connection_operations import ( build_delete_request, build_get_request, build_put_request, ) -from .._vendor import RecoveryServicesBackupClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -75,7 +78,7 @@ async def get( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.PrivateEndpointConnectionResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -98,7 +101,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -113,7 +115,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -127,8 +129,8 @@ async def _put_initial( private_endpoint_connection_name: str, parameters: Union[_models.PrivateEndpointConnectionResource, IO[bytes]], **kwargs: Any - ) -> _models.PrivateEndpointConnectionResource: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -141,7 +143,7 @@ async def _put_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PrivateEndpointConnectionResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -163,10 +165,10 @@ async def _put_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -174,14 +176,14 @@ async def _put_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -199,6 +201,7 @@ async def begin_put( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.PrivateEndpointConnectionResource]: + # pylint: disable=line-too-long """Approve or Reject Private Endpoint requests. This call is made by Backup Admin. :param vault_name: The name of the recovery services vault. Required. @@ -232,6 +235,7 @@ async def begin_put( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.PrivateEndpointConnectionResource]: + # pylint: disable=line-too-long """Approve or Reject Private Endpoint requests. This call is made by Backup Admin. :param vault_name: The name of the recovery services vault. Required. @@ -262,6 +266,7 @@ async def begin_put( parameters: Union[_models.PrivateEndpointConnectionResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.PrivateEndpointConnectionResource]: + # pylint: disable=line-too-long """Approve or Reject Private Endpoint requests. This call is made by Backup Admin. :param vault_name: The name of the recovery services vault. Required. @@ -304,10 +309,11 @@ async def begin_put( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -329,10 +335,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, vault_name: str, resource_group_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -344,7 +350,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( vault_name=vault_name, @@ -355,10 +361,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -366,11 +372,19 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -398,7 +412,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( vault_name=vault_name, resource_group_name=resource_group_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -408,6 +422,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_private_endpoint_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_private_endpoint_operations.py index 14a253c5db23..149aa4d4c218 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_private_endpoint_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_private_endpoint_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -17,17 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest 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._private_endpoint_operations import build_get_operation_status_request -from .._vendor import RecoveryServicesBackupClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -77,7 +78,7 @@ async def get_operation_status( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.OperationStatus :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -101,7 +102,6 @@ async def get_operation_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -116,7 +116,7 @@ async def get_operation_status( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("OperationStatus", pipeline_response) + deserialized = self._deserialize("OperationStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protectable_containers_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protectable_containers_operations.py index a45b9bb8b7e7..f4030739a101 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protectable_containers_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protectable_containers_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -19,17 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 from ...operations._protectable_containers_operations import build_list_request -from .._vendor import RecoveryServicesBackupClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -57,6 +58,7 @@ def __init__(self, *args, **kwargs) -> None: def list( self, vault_name: str, resource_group_name: str, fabric_name: str, filter: Optional[str] = None, **kwargs: Any ) -> AsyncIterable["_models.ProtectableContainerResource"]: + # pylint: disable=line-too-long """Lists the containers that can be registered to Recovery Services Vault. :param vault_name: The name of the recovery services vault. Required. @@ -80,7 +82,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ProtectableContainerResourceList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -101,7 +103,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -117,7 +118,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protected_item_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protected_item_operation_results_operations.py index 9300a9b643c2..d18259553f9f 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protected_item_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protected_item_operation_results_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -17,17 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest 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._protected_item_operation_results_operations import build_get_request -from .._vendor import RecoveryServicesBackupClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -82,7 +83,7 @@ async def get( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectedItemResource or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -108,7 +109,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -124,7 +124,7 @@ async def get( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProtectedItemResource", pipeline_response) + deserialized = self._deserialize("ProtectedItemResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protected_item_operation_statuses_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protected_item_operation_statuses_operations.py index eabeefbdf9d1..d56459c954d6 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protected_item_operation_statuses_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protected_item_operation_statuses_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -17,17 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest 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._protected_item_operation_statuses_operations import build_get_request -from .._vendor import RecoveryServicesBackupClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -86,7 +87,7 @@ async def get( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.OperationStatus :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -112,7 +113,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -126,7 +126,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("OperationStatus", pipeline_response) + deserialized = self._deserialize("OperationStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protected_items_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protected_items_operations.py index d4b45e3d9e36..f10cbc6cf473 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protected_items_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protected_items_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -18,21 +18,22 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest 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._protected_items_operations import ( build_create_or_update_request, build_delete_request, build_get_request, ) -from .._vendor import RecoveryServicesBackupClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -88,7 +89,7 @@ async def get( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectedItemResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -114,7 +115,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -128,7 +128,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProtectedItemResource", pipeline_response) + deserialized = self._deserialize("ProtectedItemResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -257,7 +257,7 @@ async def create_or_update( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectedItemResource or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -295,7 +295,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -311,7 +310,7 @@ async def create_or_update( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProtectedItemResource", pipeline_response) + deserialized = self._deserialize("ProtectedItemResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -319,7 +318,7 @@ async def create_or_update( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, vault_name: str, resource_group_name: str, @@ -347,7 +346,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -372,7 +371,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_container_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_container_operation_results_operations.py index e99af15ca524..f6c33df7c4cc 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_container_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_container_operation_results_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -17,17 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest 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._protection_container_operation_results_operations import build_get_request -from .._vendor import RecoveryServicesBackupClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -80,7 +81,7 @@ async def get( None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -105,7 +106,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -121,7 +121,7 @@ async def get( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProtectionContainerResource", pipeline_response) + deserialized = self._deserialize("ProtectionContainerResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_container_refresh_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_container_refresh_operation_results_operations.py index 0315e440f07c..fad279cd2ea8 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_container_refresh_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_container_refresh_operation_results_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -17,17 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest 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._protection_container_refresh_operation_results_operations import build_get_request -from .._vendor import RecoveryServicesBackupClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -52,7 +53,7 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def get( # pylint: disable=inconsistent-return-statements + async def get( self, vault_name: str, resource_group_name: str, fabric_name: str, operation_id: str, **kwargs: Any ) -> None: """Provides the result of the refresh operation triggered by the BeginRefresh operation. @@ -71,7 +72,7 @@ async def get( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -95,7 +96,6 @@ async def get( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_containers_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_containers_operations.py index b3be04766a75..31664434064d 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_containers_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_containers_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,19 +15,19 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest 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 azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._protection_containers_operations import ( build_get_request, build_inquire_request, @@ -35,8 +35,11 @@ build_register_request, build_unregister_request, ) -from .._vendor import RecoveryServicesBackupClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -79,7 +82,7 @@ async def get( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionContainerResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -103,7 +106,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -117,7 +119,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProtectionContainerResource", pipeline_response) + deserialized = self._deserialize("ProtectionContainerResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -132,8 +134,8 @@ async def _register_initial( container_name: str, parameters: Union[_models.ProtectionContainerResource, IO[bytes]], **kwargs: Any - ) -> Optional[_models.ProtectionContainerResource]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -146,7 +148,7 @@ async def _register_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.ProtectionContainerResource]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -169,10 +171,10 @@ async def _register_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -180,12 +182,14 @@ async def _register_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("ProtectionContainerResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -204,6 +208,7 @@ async def begin_register( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ProtectionContainerResource]: + # pylint: disable=line-too-long """Registers the container with Recovery Services vault. This is an asynchronous operation. To track the operation status, use location header to call get latest status of @@ -243,6 +248,7 @@ async def begin_register( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ProtectionContainerResource]: + # pylint: disable=line-too-long """Registers the container with Recovery Services vault. This is an asynchronous operation. To track the operation status, use location header to call get latest status of @@ -279,6 +285,7 @@ async def begin_register( parameters: Union[_models.ProtectionContainerResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.ProtectionContainerResource]: + # pylint: disable=line-too-long """Registers the container with Recovery Services vault. This is an asynchronous operation. To track the operation status, use location header to call get latest status of @@ -326,10 +333,11 @@ async def begin_register( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ProtectionContainerResource", pipeline_response) + deserialized = self._deserialize("ProtectionContainerResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -352,7 +360,7 @@ def get_long_running_output(pipeline_response): ) @distributed_trace_async - async def unregister( # pylint: disable=inconsistent-return-statements + async def unregister( self, vault_name: str, resource_group_name: str, fabric_name: str, container_name: str, **kwargs: Any ) -> None: """Unregisters the given container from your Recovery Services Vault. This is an asynchronous @@ -374,7 +382,7 @@ async def unregister( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -398,7 +406,6 @@ async def unregister( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -416,7 +423,7 @@ async def unregister( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async - async def inquire( # pylint: disable=inconsistent-return-statements + async def inquire( self, vault_name: str, resource_group_name: str, @@ -445,7 +452,7 @@ async def inquire( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -470,7 +477,6 @@ async def inquire( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -488,7 +494,7 @@ async def inquire( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async - async def refresh( # pylint: disable=inconsistent-return-statements + async def refresh( self, vault_name: str, resource_group_name: str, fabric_name: str, filter: Optional[str] = None, **kwargs: Any ) -> None: """Discovers all the containers in the subscription that can be backed up to Recovery Services @@ -509,7 +515,7 @@ async def refresh( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -533,7 +539,6 @@ async def refresh( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_intent_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_intent_operations.py index 2fec0b91b7e9..ac5459c0592f 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_intent_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_intent_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -18,22 +18,23 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest 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._protection_intent_operations import ( build_create_or_update_request, build_delete_request, build_get_request, build_validate_request, ) -from .._vendor import RecoveryServicesBackupClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -152,7 +153,7 @@ async def validate( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.PreValidateEnableBackupResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -185,7 +186,6 @@ async def validate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -199,7 +199,7 @@ async def validate( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PreValidateEnableBackupResponse", pipeline_response) + deserialized = self._deserialize("PreValidateEnableBackupResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -227,7 +227,7 @@ async def get( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionIntentResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -251,7 +251,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -265,7 +264,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProtectionIntentResource", pipeline_response) + deserialized = self._deserialize("ProtectionIntentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -368,7 +367,7 @@ async def create_or_update( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionIntentResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -404,7 +403,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -418,7 +416,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProtectionIntentResource", pipeline_response) + deserialized = self._deserialize("ProtectionIntentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -426,7 +424,7 @@ async def create_or_update( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, vault_name: str, resource_group_name: str, fabric_name: str, intent_object_name: str, **kwargs: Any ) -> None: """Used to remove intent from an item. @@ -444,7 +442,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -468,7 +466,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_policies_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_policies_operations.py index dc7d5c98e738..508e03b5053c 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_policies_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,26 +15,29 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest 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 azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._protection_policies_operations import ( build_create_or_update_request, build_delete_request, build_get_request, ) -from .._vendor import RecoveryServicesBackupClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -77,7 +80,7 @@ async def get( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionPolicyResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -100,7 +103,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -114,7 +116,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProtectionPolicyResource", pipeline_response) + deserialized = self._deserialize("ProtectionPolicyResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -223,7 +225,7 @@ async def create_or_update( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionPolicyResource or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -259,7 +261,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -275,17 +276,17 @@ async def create_or_update( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProtectionPolicyResource", pipeline_response) + deserialized = self._deserialize("ProtectionPolicyResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, vault_name: str, resource_group_name: str, policy_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -297,7 +298,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( vault_name=vault_name, @@ -308,10 +309,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -319,11 +320,19 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -353,7 +362,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( vault_name=vault_name, resource_group_name=resource_group_name, policy_name=policy_name, @@ -363,6 +372,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_policy_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_policy_operation_results_operations.py index 33dc696cd5ad..2abd2e0cb124 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_policy_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_policy_operation_results_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -17,17 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest 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._protection_policy_operation_results_operations import build_get_request -from .._vendor import RecoveryServicesBackupClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,7 +72,7 @@ async def get( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionPolicyResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -95,7 +96,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -109,7 +109,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProtectionPolicyResource", pipeline_response) + deserialized = self._deserialize("ProtectionPolicyResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_policy_operation_statuses_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_policy_operation_statuses_operations.py index bd4710eccb40..febe335d61a3 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_policy_operation_statuses_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_policy_operation_statuses_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -17,17 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest 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._protection_policy_operation_statuses_operations import build_get_request -from .._vendor import RecoveryServicesBackupClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -75,7 +76,7 @@ async def get( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.OperationStatus :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -99,7 +100,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -113,7 +113,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("OperationStatus", pipeline_response) + deserialized = self._deserialize("OperationStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_recovery_points_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_recovery_points_operations.py index 233eddc1a7dd..20a3e7356607 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_recovery_points_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_recovery_points_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -19,18 +19,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._recovery_points_operations import build_get_request, build_list_request -from .._vendor import RecoveryServicesBackupClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,6 +66,7 @@ def list( filter: Optional[str] = None, **kwargs: Any ) -> AsyncIterable["_models.RecoveryPointResource"]: + # pylint: disable=line-too-long """Lists the backup copies for the backed up item. :param vault_name: The name of the recovery services vault. Required. @@ -92,7 +94,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RecoveryPointResourceList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -115,7 +117,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -131,7 +132,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -194,7 +194,7 @@ async def get( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryPointResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -220,7 +220,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -234,7 +233,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecoveryPointResource", pipeline_response) + deserialized = self._deserialize("RecoveryPointResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_recovery_points_recommended_for_move_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_recovery_points_recommended_for_move_operations.py index 863b0e5be037..6ecb59fc6887 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_recovery_points_recommended_for_move_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_recovery_points_recommended_for_move_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -20,17 +20,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 from ...operations._recovery_points_recommended_for_move_operations import build_list_request -from .._vendor import RecoveryServicesBackupClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -67,6 +68,7 @@ def list( content_type: str = "application/json", **kwargs: Any ) -> AsyncIterable["_models.RecoveryPointResource"]: + # pylint: disable=line-too-long """Lists the recovery points recommended for move to another tier. :param vault_name: The name of the recovery services vault. Required. @@ -106,6 +108,7 @@ def list( content_type: str = "application/json", **kwargs: Any ) -> AsyncIterable["_models.RecoveryPointResource"]: + # pylint: disable=line-too-long """Lists the recovery points recommended for move to another tier. :param vault_name: The name of the recovery services vault. Required. @@ -142,6 +145,7 @@ def list( parameters: Union[_models.ListRecoveryPointsRecommendedForMoveRequest, IO[bytes]], **kwargs: Any ) -> AsyncIterable["_models.RecoveryPointResource"]: + # pylint: disable=line-too-long """Lists the recovery points recommended for move to another tier. :param vault_name: The name of the recovery services vault. Required. @@ -173,7 +177,7 @@ def list( content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RecoveryPointResourceList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -205,7 +209,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -221,7 +224,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_recovery_services_backup_client_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_recovery_services_backup_client_operations.py index 47f4f5b713c3..307ca1e7a0bf 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_recovery_services_backup_client_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_recovery_services_backup_client_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,19 +15,19 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest 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 azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._recovery_services_backup_client_operations import ( build_bms_prepare_data_move_request, build_bms_trigger_data_move_request, @@ -36,6 +36,10 @@ ) from .._vendor import RecoveryServicesBackupClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +47,7 @@ class RecoveryServicesBackupClientOperationsMixin( # pylint: disable=name-too-long RecoveryServicesBackupClientMixinABC ): + @distributed_trace_async async def get_operation_status( self, vault_name: str, resource_group_name: str, operation_id: str, **kwargs: Any @@ -60,7 +65,7 @@ async def get_operation_status( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.OperationStatus :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -83,7 +88,6 @@ async def get_operation_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -98,21 +102,21 @@ async def get_operation_status( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("OperationStatus", pipeline_response) + deserialized = self._deserialize("OperationStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _bms_prepare_data_move_initial( # pylint: disable=inconsistent-return-statements + async def _bms_prepare_data_move_initial( self, vault_name: str, resource_group_name: str, parameters: Union[_models.PrepareDataMoveRequest, IO[bytes]], **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -125,7 +129,7 @@ async def _bms_prepare_data_move_initial( # pylint: disable=inconsistent-return api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -146,10 +150,10 @@ async def _bms_prepare_data_move_initial( # pylint: disable=inconsistent-return headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -157,12 +161,20 @@ async def _bms_prepare_data_move_initial( # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_bms_prepare_data_move( @@ -251,7 +263,7 @@ async def begin_bms_prepare_data_move( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._bms_prepare_data_move_initial( # type: ignore + raw_result = await self._bms_prepare_data_move_initial( vault_name=vault_name, resource_group_name=resource_group_name, parameters=parameters, @@ -262,6 +274,7 @@ async def begin_bms_prepare_data_move( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -283,14 +296,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _bms_trigger_data_move_initial( # pylint: disable=inconsistent-return-statements + async def _bms_trigger_data_move_initial( self, vault_name: str, resource_group_name: str, parameters: Union[_models.TriggerDataMoveRequest, IO[bytes]], **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -303,7 +316,7 @@ async def _bms_trigger_data_move_initial( # pylint: disable=inconsistent-return api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -324,10 +337,10 @@ async def _bms_trigger_data_move_initial( # pylint: disable=inconsistent-return headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -335,12 +348,20 @@ async def _bms_trigger_data_move_initial( # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_bms_trigger_data_move( @@ -429,7 +450,7 @@ async def begin_bms_trigger_data_move( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._bms_trigger_data_move_initial( # type: ignore + raw_result = await self._bms_trigger_data_move_initial( vault_name=vault_name, resource_group_name=resource_group_name, parameters=parameters, @@ -440,6 +461,7 @@ async def begin_bms_trigger_data_move( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -461,7 +483,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _move_recovery_point_initial( # pylint: disable=inconsistent-return-statements + async def _move_recovery_point_initial( self, vault_name: str, resource_group_name: str, @@ -471,8 +493,8 @@ async def _move_recovery_point_initial( # pylint: disable=inconsistent-return-s recovery_point_id: str, parameters: Union[_models.MoveRPAcrossTiersRequest, IO[bytes]], **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -485,7 +507,7 @@ async def _move_recovery_point_initial( # pylint: disable=inconsistent-return-s api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -510,10 +532,10 @@ async def _move_recovery_point_initial( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -521,11 +543,19 @@ async def _move_recovery_point_initial( # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_move_recovery_point( @@ -657,7 +687,7 @@ async def begin_move_recovery_point( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._move_recovery_point_initial( # type: ignore + raw_result = await self._move_recovery_point_initial( vault_name=vault_name, resource_group_name=resource_group_name, fabric_name=fabric_name, @@ -672,6 +702,7 @@ async def begin_move_recovery_point( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_resource_guard_proxies_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_resource_guard_proxies_operations.py index 85cdaa43437d..99444ea8a00a 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_resource_guard_proxies_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_resource_guard_proxies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -19,17 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 from ...operations._resource_guard_proxies_operations import build_get_request -from .._vendor import RecoveryServicesBackupClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -57,6 +58,7 @@ def __init__(self, *args, **kwargs) -> None: def get( self, vault_name: str, resource_group_name: str, **kwargs: Any ) -> AsyncIterable["_models.ResourceGuardProxyBaseResource"]: + # pylint: disable=line-too-long """List the ResourceGuardProxies under vault. :param vault_name: The name of the recovery services vault. Required. @@ -76,7 +78,7 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ResourceGuardProxyBaseResourceList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -95,7 +97,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -111,7 +112,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_resource_guard_proxy_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_resource_guard_proxy_operations.py index 294512bb6ae4..57ffc7c5ab45 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_resource_guard_proxy_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_resource_guard_proxy_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -18,22 +18,23 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest 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._resource_guard_proxy_operations import ( build_delete_request, build_get_request, build_put_request, build_unlock_delete_request, ) -from .._vendor import RecoveryServicesBackupClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +75,7 @@ async def get( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ResourceGuardProxyBaseResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -97,7 +98,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -111,7 +111,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceGuardProxyBaseResource", pipeline_response) + deserialized = self._deserialize("ResourceGuardProxyBaseResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -209,7 +209,7 @@ async def put( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ResourceGuardProxyBaseResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -244,7 +244,6 @@ async def put( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -258,7 +257,7 @@ async def put( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceGuardProxyBaseResource", pipeline_response) + deserialized = self._deserialize("ResourceGuardProxyBaseResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -266,7 +265,7 @@ async def put( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, vault_name: str, resource_group_name: str, resource_guard_proxy_name: str, **kwargs: Any ) -> None: """Delete ResourceGuardProxy under vault. @@ -282,7 +281,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -305,7 +304,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -408,7 +406,7 @@ async def unlock_delete( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.UnlockDeleteResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -443,7 +441,6 @@ async def unlock_delete( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -457,7 +454,7 @@ async def unlock_delete( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("UnlockDeleteResponse", pipeline_response) + deserialized = self._deserialize("UnlockDeleteResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_restores_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_restores_operations.py index 09f88215b58b..a890c2e0af6e 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_restores_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_restores_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,22 +15,25 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest 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 azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._restores_operations import build_trigger_request -from .._vendor import RecoveryServicesBackupClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -54,7 +57,7 @@ def __init__(self, *args, **kwargs) -> None: 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") - async def _trigger_initial( # pylint: disable=inconsistent-return-statements + async def _trigger_initial( self, vault_name: str, resource_group_name: str, @@ -65,8 +68,8 @@ async def _trigger_initial( # pylint: disable=inconsistent-return-statements parameters: Union[_models.RestoreRequestResource, IO[bytes]], x_ms_authorization_auxiliary: Optional[str] = None, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -79,7 +82,7 @@ async def _trigger_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -105,10 +108,10 @@ async def _trigger_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -116,11 +119,19 @@ async def _trigger_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_trigger( @@ -263,7 +274,7 @@ async def begin_trigger( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._trigger_initial( # type: ignore + raw_result = await self._trigger_initial( vault_name=vault_name, resource_group_name=resource_group_name, fabric_name=fabric_name, @@ -279,6 +290,7 @@ async def begin_trigger( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_security_pins_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_security_pins_operations.py index 62035c853990..532b37a4ce89 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_security_pins_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_security_pins_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -18,17 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest 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._security_pins_operations import build_get_request -from .._vendor import RecoveryServicesBackupClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -138,7 +139,7 @@ async def get( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.TokenInformation :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -176,7 +177,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -190,7 +190,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TokenInformation", pipeline_response) + deserialized = self._deserialize("TokenInformation", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_tiering_cost_operation_status_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_tiering_cost_operation_status_operations.py index 06ba4bf90dec..eb14512d3f2f 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_tiering_cost_operation_status_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_tiering_cost_operation_status_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -17,17 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest 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._tiering_cost_operation_status_operations import build_get_request -from .._vendor import RecoveryServicesBackupClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -68,7 +69,7 @@ async def get( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.OperationStatus :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -91,7 +92,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -105,7 +105,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("OperationStatus", pipeline_response) + deserialized = self._deserialize("OperationStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_validate_operation_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_validate_operation_operations.py index 5169b40f3c46..0afafd9c4056 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_validate_operation_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_validate_operation_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,22 +15,25 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest 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 azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._validate_operation_operations import build_trigger_request -from .._vendor import RecoveryServicesBackupClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -54,14 +57,14 @@ def __init__(self, *args, **kwargs) -> None: 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") - async def _trigger_initial( # pylint: disable=inconsistent-return-statements + async def _trigger_initial( self, vault_name: str, resource_group_name: str, parameters: Union[_models.ValidateOperationRequestResource, IO[bytes]], **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -74,7 +77,7 @@ async def _trigger_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -95,10 +98,10 @@ async def _trigger_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -106,11 +109,19 @@ async def _trigger_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_trigger( @@ -204,7 +215,7 @@ async def begin_trigger( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._trigger_initial( # type: ignore + raw_result = await self._trigger_initial( vault_name=vault_name, resource_group_name=resource_group_name, parameters=parameters, @@ -215,6 +226,7 @@ async def begin_trigger( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_validate_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_validate_operation_results_operations.py index 50721e2d7724..9de83963803c 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_validate_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_validate_operation_results_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -17,17 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest 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._validate_operation_results_operations import build_get_request -from .._vendor import RecoveryServicesBackupClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,7 +71,7 @@ async def get( None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -93,7 +94,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -109,7 +109,7 @@ async def get( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ValidateOperationsResponse", pipeline_response) + deserialized = self._deserialize("ValidateOperationsResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_validate_operation_statuses_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_validate_operation_statuses_operations.py index e81957266b3a..64af23ad960f 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_validate_operation_statuses_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_validate_operation_statuses_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -17,17 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest 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._validate_operation_statuses_operations import build_get_request -from .._vendor import RecoveryServicesBackupClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +74,7 @@ async def get( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.OperationStatus :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -96,7 +97,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -110,7 +110,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("OperationStatus", pipeline_response) + deserialized = self._deserialize("OperationStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/models/__init__.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/models/__init__.py index 3f5044b6d508..6646c3f0a09d 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/models/__init__.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/models/__init__.py @@ -5,393 +5,404 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._models_py3 import AzureBackupGoalFeatureSupportRequest -from ._models_py3 import AzureBackupServerContainer -from ._models_py3 import AzureBackupServerEngine -from ._models_py3 import AzureFileShareBackupRequest -from ._models_py3 import AzureFileShareProtectableItem -from ._models_py3 import AzureFileShareProtectionPolicy -from ._models_py3 import AzureFileShareProvisionILRRequest -from ._models_py3 import AzureFileShareRecoveryPoint -from ._models_py3 import AzureFileShareRestoreRequest -from ._models_py3 import AzureFileshareProtectedItem -from ._models_py3 import AzureFileshareProtectedItemExtendedInfo -from ._models_py3 import AzureIaaSClassicComputeVMContainer -from ._models_py3 import AzureIaaSClassicComputeVMProtectableItem -from ._models_py3 import AzureIaaSClassicComputeVMProtectedItem -from ._models_py3 import AzureIaaSComputeVMContainer -from ._models_py3 import AzureIaaSComputeVMProtectableItem -from ._models_py3 import AzureIaaSComputeVMProtectedItem -from ._models_py3 import AzureIaaSVMErrorInfo -from ._models_py3 import AzureIaaSVMHealthDetails -from ._models_py3 import AzureIaaSVMJob -from ._models_py3 import AzureIaaSVMJobExtendedInfo -from ._models_py3 import AzureIaaSVMJobTaskDetails -from ._models_py3 import AzureIaaSVMJobV2 -from ._models_py3 import AzureIaaSVMProtectedItem -from ._models_py3 import AzureIaaSVMProtectedItemExtendedInfo -from ._models_py3 import AzureIaaSVMProtectionPolicy -from ._models_py3 import AzureRecoveryServiceVaultProtectionIntent -from ._models_py3 import AzureResourceProtectionIntent -from ._models_py3 import AzureSQLAGWorkloadContainerProtectionContainer -from ._models_py3 import AzureSqlContainer -from ._models_py3 import AzureSqlProtectedItem -from ._models_py3 import AzureSqlProtectedItemExtendedInfo -from ._models_py3 import AzureSqlProtectionPolicy -from ._models_py3 import AzureStorageContainer -from ._models_py3 import AzureStorageErrorInfo -from ._models_py3 import AzureStorageJob -from ._models_py3 import AzureStorageJobExtendedInfo -from ._models_py3 import AzureStorageJobTaskDetails -from ._models_py3 import AzureStorageProtectableContainer -from ._models_py3 import AzureVMAppContainerProtectableContainer -from ._models_py3 import AzureVMAppContainerProtectionContainer -from ._models_py3 import AzureVMResourceFeatureSupportRequest -from ._models_py3 import AzureVMResourceFeatureSupportResponse -from ._models_py3 import AzureVmWorkloadItem -from ._models_py3 import AzureVmWorkloadProtectableItem -from ._models_py3 import AzureVmWorkloadProtectedItem -from ._models_py3 import AzureVmWorkloadProtectedItemExtendedInfo -from ._models_py3 import AzureVmWorkloadProtectionPolicy -from ._models_py3 import AzureVmWorkloadSAPAseDatabaseProtectedItem -from ._models_py3 import AzureVmWorkloadSAPAseDatabaseWorkloadItem -from ._models_py3 import AzureVmWorkloadSAPAseSystemProtectableItem -from ._models_py3 import AzureVmWorkloadSAPAseSystemWorkloadItem -from ._models_py3 import AzureVmWorkloadSAPHanaDBInstance -from ._models_py3 import AzureVmWorkloadSAPHanaDBInstanceProtectedItem -from ._models_py3 import AzureVmWorkloadSAPHanaDatabaseProtectableItem -from ._models_py3 import AzureVmWorkloadSAPHanaDatabaseProtectedItem -from ._models_py3 import AzureVmWorkloadSAPHanaDatabaseWorkloadItem -from ._models_py3 import AzureVmWorkloadSAPHanaHSRProtectableItem -from ._models_py3 import AzureVmWorkloadSAPHanaSystemProtectableItem -from ._models_py3 import AzureVmWorkloadSAPHanaSystemWorkloadItem -from ._models_py3 import AzureVmWorkloadSQLAvailabilityGroupProtectableItem -from ._models_py3 import AzureVmWorkloadSQLDatabaseProtectableItem -from ._models_py3 import AzureVmWorkloadSQLDatabaseProtectedItem -from ._models_py3 import AzureVmWorkloadSQLDatabaseWorkloadItem -from ._models_py3 import AzureVmWorkloadSQLInstanceProtectableItem -from ._models_py3 import AzureVmWorkloadSQLInstanceWorkloadItem -from ._models_py3 import AzureWorkloadAutoProtectionIntent -from ._models_py3 import AzureWorkloadBackupRequest -from ._models_py3 import AzureWorkloadContainer -from ._models_py3 import AzureWorkloadContainerAutoProtectionIntent -from ._models_py3 import AzureWorkloadContainerExtendedInfo -from ._models_py3 import AzureWorkloadErrorInfo -from ._models_py3 import AzureWorkloadJob -from ._models_py3 import AzureWorkloadJobExtendedInfo -from ._models_py3 import AzureWorkloadJobTaskDetails -from ._models_py3 import AzureWorkloadPointInTimeRecoveryPoint -from ._models_py3 import AzureWorkloadPointInTimeRestoreRequest -from ._models_py3 import AzureWorkloadRecoveryPoint -from ._models_py3 import AzureWorkloadRestoreRequest -from ._models_py3 import AzureWorkloadSAPHanaPointInTimeRecoveryPoint -from ._models_py3 import AzureWorkloadSAPHanaPointInTimeRestoreRequest -from ._models_py3 import AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest -from ._models_py3 import AzureWorkloadSAPHanaRecoveryPoint -from ._models_py3 import AzureWorkloadSAPHanaRestoreRequest -from ._models_py3 import AzureWorkloadSAPHanaRestoreWithRehydrateRequest -from ._models_py3 import AzureWorkloadSQLAutoProtectionIntent -from ._models_py3 import AzureWorkloadSQLPointInTimeRecoveryPoint -from ._models_py3 import AzureWorkloadSQLPointInTimeRestoreRequest -from ._models_py3 import AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest -from ._models_py3 import AzureWorkloadSQLRecoveryPoint -from ._models_py3 import AzureWorkloadSQLRecoveryPointExtendedInfo -from ._models_py3 import AzureWorkloadSQLRestoreRequest -from ._models_py3 import AzureWorkloadSQLRestoreWithRehydrateRequest -from ._models_py3 import BEKDetails -from ._models_py3 import BMSBackupEngineQueryObject -from ._models_py3 import BMSBackupEnginesQueryObject -from ._models_py3 import BMSBackupSummariesQueryObject -from ._models_py3 import BMSContainerQueryObject -from ._models_py3 import BMSContainersInquiryQueryObject -from ._models_py3 import BMSPOQueryObject -from ._models_py3 import BMSRPQueryObject -from ._models_py3 import BMSRefreshContainersQueryObject -from ._models_py3 import BMSWorkloadItemQueryObject -from ._models_py3 import BackupEngineBase -from ._models_py3 import BackupEngineBaseResource -from ._models_py3 import BackupEngineBaseResourceList -from ._models_py3 import BackupEngineExtendedInfo -from ._models_py3 import BackupManagementUsage -from ._models_py3 import BackupManagementUsageList -from ._models_py3 import BackupRequest -from ._models_py3 import BackupRequestResource -from ._models_py3 import BackupResourceConfig -from ._models_py3 import BackupResourceConfigResource -from ._models_py3 import BackupResourceEncryptionConfig -from ._models_py3 import BackupResourceEncryptionConfigExtended -from ._models_py3 import BackupResourceEncryptionConfigExtendedResource -from ._models_py3 import BackupResourceEncryptionConfigResource -from ._models_py3 import BackupResourceVaultConfig -from ._models_py3 import BackupResourceVaultConfigResource -from ._models_py3 import BackupStatusRequest -from ._models_py3 import BackupStatusResponse -from ._models_py3 import ClientDiscoveryDisplay -from ._models_py3 import ClientDiscoveryForLogSpecification -from ._models_py3 import ClientDiscoveryForProperties -from ._models_py3 import ClientDiscoveryForServiceSpecification -from ._models_py3 import ClientDiscoveryResponse -from ._models_py3 import ClientDiscoveryValueForSingleApi -from ._models_py3 import ClientScriptForConnect -from ._models_py3 import CloudErrorBody -from ._models_py3 import ContainerIdentityInfo -from ._models_py3 import DPMContainerExtendedInfo -from ._models_py3 import DPMProtectedItem -from ._models_py3 import DPMProtectedItemExtendedInfo -from ._models_py3 import DailyRetentionFormat -from ._models_py3 import DailyRetentionSchedule -from ._models_py3 import DailySchedule -from ._models_py3 import Day -from ._models_py3 import DiskExclusionProperties -from ._models_py3 import DiskInformation -from ._models_py3 import DistributedNodesInfo -from ._models_py3 import DpmBackupEngine -from ._models_py3 import DpmContainer -from ._models_py3 import DpmErrorInfo -from ._models_py3 import DpmJob -from ._models_py3 import DpmJobExtendedInfo -from ._models_py3 import DpmJobTaskDetails -from ._models_py3 import EncryptionDetails -from ._models_py3 import ErrorAdditionalInfo -from ._models_py3 import ErrorDetail -from ._models_py3 import ExportJobsOperationResultInfo -from ._models_py3 import ExtendedLocation -from ._models_py3 import ExtendedProperties -from ._models_py3 import FeatureSupportRequest -from ._models_py3 import FetchTieringCostInfoForRehydrationRequest -from ._models_py3 import FetchTieringCostInfoRequest -from ._models_py3 import FetchTieringCostSavingsInfoForPolicyRequest -from ._models_py3 import FetchTieringCostSavingsInfoForProtectedItemRequest -from ._models_py3 import FetchTieringCostSavingsInfoForVaultRequest -from ._models_py3 import GenericContainer -from ._models_py3 import GenericContainerExtendedInfo -from ._models_py3 import GenericProtectedItem -from ._models_py3 import GenericProtectionPolicy -from ._models_py3 import GenericRecoveryPoint -from ._models_py3 import GetProtectedItemQueryObject -from ._models_py3 import HourlySchedule -from ._models_py3 import ILRRequest -from ._models_py3 import ILRRequestResource -from ._models_py3 import IaaSVMContainer -from ._models_py3 import IaaSVMProtectableItem -from ._models_py3 import IaasVMBackupRequest -from ._models_py3 import IaasVMILRRegistrationRequest -from ._models_py3 import IaasVMRecoveryPoint -from ._models_py3 import IaasVMRestoreRequest -from ._models_py3 import IaasVMRestoreWithRehydrationRequest -from ._models_py3 import IdentityBasedRestoreDetails -from ._models_py3 import IdentityInfo -from ._models_py3 import InquiryInfo -from ._models_py3 import InquiryValidation -from ._models_py3 import InstantItemRecoveryTarget -from ._models_py3 import InstantRPAdditionalDetails -from ._models_py3 import Job -from ._models_py3 import JobQueryObject -from ._models_py3 import JobResource -from ._models_py3 import JobResourceList -from ._models_py3 import KEKDetails -from ._models_py3 import KPIResourceHealthDetails -from ._models_py3 import KeyAndSecretDetails -from ._models_py3 import ListRecoveryPointsRecommendedForMoveRequest -from ._models_py3 import LogSchedulePolicy -from ._models_py3 import LongTermRetentionPolicy -from ._models_py3 import LongTermSchedulePolicy -from ._models_py3 import MABContainerHealthDetails -from ._models_py3 import MabContainer -from ._models_py3 import MabContainerExtendedInfo -from ._models_py3 import MabErrorInfo -from ._models_py3 import MabFileFolderProtectedItem -from ._models_py3 import MabFileFolderProtectedItemExtendedInfo -from ._models_py3 import MabJob -from ._models_py3 import MabJobExtendedInfo -from ._models_py3 import MabJobTaskDetails -from ._models_py3 import MabProtectionPolicy -from ._models_py3 import MonthlyRetentionSchedule -from ._models_py3 import MoveRPAcrossTiersRequest -from ._models_py3 import NameInfo -from ._models_py3 import NewErrorResponse -from ._models_py3 import NewErrorResponseError -from ._models_py3 import OperationResultInfo -from ._models_py3 import OperationResultInfoBase -from ._models_py3 import OperationResultInfoBaseResource -from ._models_py3 import OperationStatus -from ._models_py3 import OperationStatusError -from ._models_py3 import OperationStatusExtendedInfo -from ._models_py3 import OperationStatusJobExtendedInfo -from ._models_py3 import OperationStatusJobsExtendedInfo -from ._models_py3 import OperationStatusProvisionILRExtendedInfo -from ._models_py3 import OperationStatusValidateOperationExtendedInfo -from ._models_py3 import OperationWorkerResponse -from ._models_py3 import PointInTimeRange -from ._models_py3 import PreBackupValidation -from ._models_py3 import PreValidateEnableBackupRequest -from ._models_py3 import PreValidateEnableBackupResponse -from ._models_py3 import PrepareDataMoveRequest -from ._models_py3 import PrepareDataMoveResponse -from ._models_py3 import PrivateEndpoint -from ._models_py3 import PrivateEndpointConnection -from ._models_py3 import PrivateEndpointConnectionResource -from ._models_py3 import PrivateLinkServiceConnectionState -from ._models_py3 import ProtectableContainer -from ._models_py3 import ProtectableContainerResource -from ._models_py3 import ProtectableContainerResourceList -from ._models_py3 import ProtectedItem -from ._models_py3 import ProtectedItemQueryObject -from ._models_py3 import ProtectedItemResource -from ._models_py3 import ProtectedItemResourceList -from ._models_py3 import ProtectionContainer -from ._models_py3 import ProtectionContainerResource -from ._models_py3 import ProtectionContainerResourceList -from ._models_py3 import ProtectionIntent -from ._models_py3 import ProtectionIntentQueryObject -from ._models_py3 import ProtectionIntentResource -from ._models_py3 import ProtectionIntentResourceList -from ._models_py3 import ProtectionPolicy -from ._models_py3 import ProtectionPolicyQueryObject -from ._models_py3 import ProtectionPolicyResource -from ._models_py3 import ProtectionPolicyResourceList -from ._models_py3 import RecoveryPoint -from ._models_py3 import RecoveryPointDiskConfiguration -from ._models_py3 import RecoveryPointMoveReadinessInfo -from ._models_py3 import RecoveryPointProperties -from ._models_py3 import RecoveryPointRehydrationInfo -from ._models_py3 import RecoveryPointResource -from ._models_py3 import RecoveryPointResourceList -from ._models_py3 import RecoveryPointTierInformation -from ._models_py3 import RecoveryPointTierInformationV2 -from ._models_py3 import Resource -from ._models_py3 import ResourceGuardOperationDetail -from ._models_py3 import ResourceGuardProxyBase -from ._models_py3 import ResourceGuardProxyBaseResource -from ._models_py3 import ResourceGuardProxyBaseResourceList -from ._models_py3 import ResourceHealthDetails -from ._models_py3 import ResourceList -from ._models_py3 import RestoreFileSpecs -from ._models_py3 import RestoreRequest -from ._models_py3 import RestoreRequestResource -from ._models_py3 import RetentionDuration -from ._models_py3 import RetentionPolicy -from ._models_py3 import SQLDataDirectory -from ._models_py3 import SQLDataDirectoryMapping -from ._models_py3 import SchedulePolicy -from ._models_py3 import SecuredVMDetails -from ._models_py3 import SecurityPinBase -from ._models_py3 import Settings -from ._models_py3 import SimpleRetentionPolicy -from ._models_py3 import SimpleSchedulePolicy -from ._models_py3 import SimpleSchedulePolicyV2 -from ._models_py3 import SnapshotBackupAdditionalDetails -from ._models_py3 import SnapshotRestoreParameters -from ._models_py3 import SubProtectionPolicy -from ._models_py3 import TargetAFSRestoreInfo -from ._models_py3 import TargetDiskNetworkAccessSettings -from ._models_py3 import TargetRestoreInfo -from ._models_py3 import TieringCostInfo -from ._models_py3 import TieringCostRehydrationInfo -from ._models_py3 import TieringCostSavingInfo -from ._models_py3 import TieringPolicy -from ._models_py3 import TokenInformation -from ._models_py3 import TriggerDataMoveRequest -from ._models_py3 import UnlockDeleteRequest -from ._models_py3 import UnlockDeleteResponse -from ._models_py3 import UserAssignedIdentityProperties -from ._models_py3 import UserAssignedManagedIdentityDetails -from ._models_py3 import ValidateIaasVMRestoreOperationRequest -from ._models_py3 import ValidateOperationRequest -from ._models_py3 import ValidateOperationRequestResource -from ._models_py3 import ValidateOperationResponse -from ._models_py3 import ValidateOperationsResponse -from ._models_py3 import ValidateRestoreOperationRequest -from ._models_py3 import VaultJob -from ._models_py3 import VaultJobErrorInfo -from ._models_py3 import VaultJobExtendedInfo -from ._models_py3 import VaultRetentionPolicy -from ._models_py3 import VaultStorageConfigOperationResultResponse -from ._models_py3 import WeeklyRetentionFormat -from ._models_py3 import WeeklyRetentionSchedule -from ._models_py3 import WeeklySchedule -from ._models_py3 import WorkloadInquiryDetails -from ._models_py3 import WorkloadItem -from ._models_py3 import WorkloadItemResource -from ._models_py3 import WorkloadItemResourceList -from ._models_py3 import WorkloadProtectableItem -from ._models_py3 import WorkloadProtectableItemResource -from ._models_py3 import WorkloadProtectableItemResourceList -from ._models_py3 import YearlyRetentionSchedule +from typing import TYPE_CHECKING -from ._recovery_services_backup_client_enums import AcquireStorageAccountLock -from ._recovery_services_backup_client_enums import AzureFileShareType -from ._recovery_services_backup_client_enums import BackupEngineType -from ._recovery_services_backup_client_enums import BackupItemType -from ._recovery_services_backup_client_enums import BackupManagementType -from ._recovery_services_backup_client_enums import BackupType -from ._recovery_services_backup_client_enums import ContainerType -from ._recovery_services_backup_client_enums import CopyOptions -from ._recovery_services_backup_client_enums import CreateMode -from ._recovery_services_backup_client_enums import DataMoveLevel -from ._recovery_services_backup_client_enums import DataSourceType -from ._recovery_services_backup_client_enums import DayOfWeek -from ._recovery_services_backup_client_enums import DedupState -from ._recovery_services_backup_client_enums import EncryptionAtRestType -from ._recovery_services_backup_client_enums import EnhancedSecurityState -from ._recovery_services_backup_client_enums import FabricName -from ._recovery_services_backup_client_enums import HealthState -from ._recovery_services_backup_client_enums import HealthStatus -from ._recovery_services_backup_client_enums import HttpStatusCode -from ._recovery_services_backup_client_enums import IAASVMPolicyType -from ._recovery_services_backup_client_enums import IaasVMSnapshotConsistencyType -from ._recovery_services_backup_client_enums import InfrastructureEncryptionState -from ._recovery_services_backup_client_enums import InquiryStatus -from ._recovery_services_backup_client_enums import IntentItemType -from ._recovery_services_backup_client_enums import JobOperationType -from ._recovery_services_backup_client_enums import JobStatus -from ._recovery_services_backup_client_enums import JobSupportedAction -from ._recovery_services_backup_client_enums import LastBackupStatus -from ._recovery_services_backup_client_enums import LastUpdateStatus -from ._recovery_services_backup_client_enums import MabServerType -from ._recovery_services_backup_client_enums import MonthOfYear -from ._recovery_services_backup_client_enums import OperationStatusValues -from ._recovery_services_backup_client_enums import OperationType -from ._recovery_services_backup_client_enums import OverwriteOptions -from ._recovery_services_backup_client_enums import PolicyType -from ._recovery_services_backup_client_enums import PrivateEndpointConnectionStatus -from ._recovery_services_backup_client_enums import ProtectableContainerType -from ._recovery_services_backup_client_enums import ProtectedItemHealthStatus -from ._recovery_services_backup_client_enums import ProtectedItemState -from ._recovery_services_backup_client_enums import ProtectionIntentItemType -from ._recovery_services_backup_client_enums import ProtectionState -from ._recovery_services_backup_client_enums import ProtectionStatus -from ._recovery_services_backup_client_enums import ProvisioningState -from ._recovery_services_backup_client_enums import RecoveryMode -from ._recovery_services_backup_client_enums import RecoveryPointTierStatus -from ._recovery_services_backup_client_enums import RecoveryPointTierType -from ._recovery_services_backup_client_enums import RecoveryType -from ._recovery_services_backup_client_enums import RehydrationPriority -from ._recovery_services_backup_client_enums import ResourceHealthStatus -from ._recovery_services_backup_client_enums import RestorePointQueryType -from ._recovery_services_backup_client_enums import RestorePointType -from ._recovery_services_backup_client_enums import RestoreRequestType -from ._recovery_services_backup_client_enums import RetentionDurationType -from ._recovery_services_backup_client_enums import RetentionScheduleFormat -from ._recovery_services_backup_client_enums import SQLDataDirectoryType -from ._recovery_services_backup_client_enums import ScheduleRunType -from ._recovery_services_backup_client_enums import SoftDeleteFeatureState -from ._recovery_services_backup_client_enums import StorageType -from ._recovery_services_backup_client_enums import StorageTypeState -from ._recovery_services_backup_client_enums import SupportStatus -from ._recovery_services_backup_client_enums import TargetDiskNetworkAccessOption -from ._recovery_services_backup_client_enums import TieringMode -from ._recovery_services_backup_client_enums import Type -from ._recovery_services_backup_client_enums import UsagesUnit -from ._recovery_services_backup_client_enums import ValidationStatus -from ._recovery_services_backup_client_enums import VaultSubResourceType -from ._recovery_services_backup_client_enums import WeekOfMonth -from ._recovery_services_backup_client_enums import WorkloadItemType -from ._recovery_services_backup_client_enums import WorkloadType -from ._recovery_services_backup_client_enums import XcoolState +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + AzureBackupGoalFeatureSupportRequest, + AzureBackupServerContainer, + AzureBackupServerEngine, + AzureFileShareBackupRequest, + AzureFileShareProtectableItem, + AzureFileShareProtectionPolicy, + AzureFileShareProvisionILRRequest, + AzureFileShareRecoveryPoint, + AzureFileShareRestoreRequest, + AzureFileshareProtectedItem, + AzureFileshareProtectedItemExtendedInfo, + AzureIaaSClassicComputeVMContainer, + AzureIaaSClassicComputeVMProtectableItem, + AzureIaaSClassicComputeVMProtectedItem, + AzureIaaSComputeVMContainer, + AzureIaaSComputeVMProtectableItem, + AzureIaaSComputeVMProtectedItem, + AzureIaaSVMErrorInfo, + AzureIaaSVMHealthDetails, + AzureIaaSVMJob, + AzureIaaSVMJobExtendedInfo, + AzureIaaSVMJobTaskDetails, + AzureIaaSVMJobV2, + AzureIaaSVMProtectedItem, + AzureIaaSVMProtectedItemExtendedInfo, + AzureIaaSVMProtectionPolicy, + AzureRecoveryServiceVaultProtectionIntent, + AzureResourceProtectionIntent, + AzureSQLAGWorkloadContainerProtectionContainer, + AzureSqlContainer, + AzureSqlProtectedItem, + AzureSqlProtectedItemExtendedInfo, + AzureSqlProtectionPolicy, + AzureStorageContainer, + AzureStorageErrorInfo, + AzureStorageJob, + AzureStorageJobExtendedInfo, + AzureStorageJobTaskDetails, + AzureStorageProtectableContainer, + AzureVMAppContainerProtectableContainer, + AzureVMAppContainerProtectionContainer, + AzureVMResourceFeatureSupportRequest, + AzureVMResourceFeatureSupportResponse, + AzureVmWorkloadItem, + AzureVmWorkloadProtectableItem, + AzureVmWorkloadProtectedItem, + AzureVmWorkloadProtectedItemExtendedInfo, + AzureVmWorkloadProtectionPolicy, + AzureVmWorkloadSAPAseDatabaseProtectedItem, + AzureVmWorkloadSAPAseDatabaseWorkloadItem, + AzureVmWorkloadSAPAseSystemProtectableItem, + AzureVmWorkloadSAPAseSystemWorkloadItem, + AzureVmWorkloadSAPHanaDBInstance, + AzureVmWorkloadSAPHanaDBInstanceProtectedItem, + AzureVmWorkloadSAPHanaDatabaseProtectableItem, + AzureVmWorkloadSAPHanaDatabaseProtectedItem, + AzureVmWorkloadSAPHanaDatabaseWorkloadItem, + AzureVmWorkloadSAPHanaHSRProtectableItem, + AzureVmWorkloadSAPHanaSystemProtectableItem, + AzureVmWorkloadSAPHanaSystemWorkloadItem, + AzureVmWorkloadSQLAvailabilityGroupProtectableItem, + AzureVmWorkloadSQLDatabaseProtectableItem, + AzureVmWorkloadSQLDatabaseProtectedItem, + AzureVmWorkloadSQLDatabaseWorkloadItem, + AzureVmWorkloadSQLInstanceProtectableItem, + AzureVmWorkloadSQLInstanceWorkloadItem, + AzureWorkloadAutoProtectionIntent, + AzureWorkloadBackupRequest, + AzureWorkloadContainer, + AzureWorkloadContainerAutoProtectionIntent, + AzureWorkloadContainerExtendedInfo, + AzureWorkloadErrorInfo, + AzureWorkloadJob, + AzureWorkloadJobExtendedInfo, + AzureWorkloadJobTaskDetails, + AzureWorkloadPointInTimeRecoveryPoint, + AzureWorkloadPointInTimeRestoreRequest, + AzureWorkloadRecoveryPoint, + AzureWorkloadRestoreRequest, + AzureWorkloadSAPHanaPointInTimeRecoveryPoint, + AzureWorkloadSAPHanaPointInTimeRestoreRequest, + AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest, + AzureWorkloadSAPHanaRecoveryPoint, + AzureWorkloadSAPHanaRestoreRequest, + AzureWorkloadSAPHanaRestoreWithRehydrateRequest, + AzureWorkloadSQLAutoProtectionIntent, + AzureWorkloadSQLPointInTimeRecoveryPoint, + AzureWorkloadSQLPointInTimeRestoreRequest, + AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest, + AzureWorkloadSQLRecoveryPoint, + AzureWorkloadSQLRecoveryPointExtendedInfo, + AzureWorkloadSQLRestoreRequest, + AzureWorkloadSQLRestoreWithRehydrateRequest, + BEKDetails, + BMSBackupEngineQueryObject, + BMSBackupEnginesQueryObject, + BMSBackupSummariesQueryObject, + BMSContainerQueryObject, + BMSContainersInquiryQueryObject, + BMSPOQueryObject, + BMSRPQueryObject, + BMSRefreshContainersQueryObject, + BMSWorkloadItemQueryObject, + BackupEngineBase, + BackupEngineBaseResource, + BackupEngineBaseResourceList, + BackupEngineExtendedInfo, + BackupManagementUsage, + BackupManagementUsageList, + BackupRequest, + BackupRequestResource, + BackupResourceConfig, + BackupResourceConfigResource, + BackupResourceEncryptionConfig, + BackupResourceEncryptionConfigExtended, + BackupResourceEncryptionConfigExtendedResource, + BackupResourceEncryptionConfigResource, + BackupResourceVaultConfig, + BackupResourceVaultConfigResource, + BackupStatusRequest, + BackupStatusResponse, + ClientDiscoveryDisplay, + ClientDiscoveryForLogSpecification, + ClientDiscoveryForProperties, + ClientDiscoveryForServiceSpecification, + ClientDiscoveryResponse, + ClientDiscoveryValueForSingleApi, + ClientScriptForConnect, + CloudErrorBody, + ContainerIdentityInfo, + DPMContainerExtendedInfo, + DPMProtectedItem, + DPMProtectedItemExtendedInfo, + DailyRetentionFormat, + DailyRetentionSchedule, + DailySchedule, + Day, + DiskExclusionProperties, + DiskInformation, + DistributedNodesInfo, + DpmBackupEngine, + DpmContainer, + DpmErrorInfo, + DpmJob, + DpmJobExtendedInfo, + DpmJobTaskDetails, + EncryptionDetails, + ErrorAdditionalInfo, + ErrorDetail, + ExportJobsOperationResultInfo, + ExtendedLocation, + ExtendedProperties, + FeatureSupportRequest, + FetchTieringCostInfoForRehydrationRequest, + FetchTieringCostInfoRequest, + FetchTieringCostSavingsInfoForPolicyRequest, + FetchTieringCostSavingsInfoForProtectedItemRequest, + FetchTieringCostSavingsInfoForVaultRequest, + GenericContainer, + GenericContainerExtendedInfo, + GenericProtectedItem, + GenericProtectionPolicy, + GenericRecoveryPoint, + GetProtectedItemQueryObject, + HourlySchedule, + ILRRequest, + ILRRequestResource, + IaaSVMContainer, + IaaSVMProtectableItem, + IaasVMBackupRequest, + IaasVMILRRegistrationRequest, + IaasVMRecoveryPoint, + IaasVMRestoreRequest, + IaasVMRestoreWithRehydrationRequest, + IdentityBasedRestoreDetails, + IdentityInfo, + InquiryInfo, + InquiryValidation, + InstantItemRecoveryTarget, + InstantRPAdditionalDetails, + Job, + JobQueryObject, + JobResource, + JobResourceList, + KEKDetails, + KPIResourceHealthDetails, + KeyAndSecretDetails, + ListRecoveryPointsRecommendedForMoveRequest, + LogSchedulePolicy, + LongTermRetentionPolicy, + LongTermSchedulePolicy, + MABContainerHealthDetails, + MabContainer, + MabContainerExtendedInfo, + MabErrorInfo, + MabFileFolderProtectedItem, + MabFileFolderProtectedItemExtendedInfo, + MabJob, + MabJobExtendedInfo, + MabJobTaskDetails, + MabProtectionPolicy, + MonthlyRetentionSchedule, + MoveRPAcrossTiersRequest, + NameInfo, + NewErrorResponse, + NewErrorResponseError, + OperationResultInfo, + OperationResultInfoBase, + OperationResultInfoBaseResource, + OperationStatus, + OperationStatusError, + OperationStatusExtendedInfo, + OperationStatusJobExtendedInfo, + OperationStatusJobsExtendedInfo, + OperationStatusProvisionILRExtendedInfo, + OperationStatusValidateOperationExtendedInfo, + OperationWorkerResponse, + PointInTimeRange, + PreBackupValidation, + PreValidateEnableBackupRequest, + PreValidateEnableBackupResponse, + PrepareDataMoveRequest, + PrepareDataMoveResponse, + PrivateEndpoint, + PrivateEndpointConnection, + PrivateEndpointConnectionResource, + PrivateLinkServiceConnectionState, + ProtectableContainer, + ProtectableContainerResource, + ProtectableContainerResourceList, + ProtectedItem, + ProtectedItemQueryObject, + ProtectedItemResource, + ProtectedItemResourceList, + ProtectionContainer, + ProtectionContainerResource, + ProtectionContainerResourceList, + ProtectionIntent, + ProtectionIntentQueryObject, + ProtectionIntentResource, + ProtectionIntentResourceList, + ProtectionPolicy, + ProtectionPolicyQueryObject, + ProtectionPolicyResource, + ProtectionPolicyResourceList, + RecoveryPoint, + RecoveryPointDiskConfiguration, + RecoveryPointMoveReadinessInfo, + RecoveryPointProperties, + RecoveryPointRehydrationInfo, + RecoveryPointResource, + RecoveryPointResourceList, + RecoveryPointTierInformation, + RecoveryPointTierInformationV2, + Resource, + ResourceGuardOperationDetail, + ResourceGuardProxyBase, + ResourceGuardProxyBaseResource, + ResourceGuardProxyBaseResourceList, + ResourceHealthDetails, + ResourceList, + RestoreFileSpecs, + RestoreRequest, + RestoreRequestResource, + RetentionDuration, + RetentionPolicy, + SQLDataDirectory, + SQLDataDirectoryMapping, + SchedulePolicy, + SecuredVMDetails, + SecurityPinBase, + Settings, + SimpleRetentionPolicy, + SimpleSchedulePolicy, + SimpleSchedulePolicyV2, + SnapshotBackupAdditionalDetails, + SnapshotRestoreParameters, + SubProtectionPolicy, + TargetAFSRestoreInfo, + TargetDiskNetworkAccessSettings, + TargetRestoreInfo, + TieringCostInfo, + TieringCostRehydrationInfo, + TieringCostSavingInfo, + TieringPolicy, + TokenInformation, + TriggerDataMoveRequest, + UnlockDeleteRequest, + UnlockDeleteResponse, + UserAssignedIdentityProperties, + UserAssignedManagedIdentityDetails, + ValidateIaasVMRestoreOperationRequest, + ValidateOperationRequest, + ValidateOperationRequestResource, + ValidateOperationResponse, + ValidateOperationsResponse, + ValidateRestoreOperationRequest, + VaultJob, + VaultJobErrorInfo, + VaultJobExtendedInfo, + VaultRetentionPolicy, + VaultStorageConfigOperationResultResponse, + WeeklyRetentionFormat, + WeeklyRetentionSchedule, + WeeklySchedule, + WorkloadInquiryDetails, + WorkloadItem, + WorkloadItemResource, + WorkloadItemResourceList, + WorkloadProtectableItem, + WorkloadProtectableItemResource, + WorkloadProtectableItemResourceList, + YearlyRetentionSchedule, +) + +from ._recovery_services_backup_client_enums import ( # type: ignore + AcquireStorageAccountLock, + AzureFileShareType, + BackupEngineType, + BackupItemType, + BackupManagementType, + BackupType, + ContainerType, + CopyOptions, + CreateMode, + DataMoveLevel, + DataSourceType, + DayOfWeek, + DedupState, + EncryptionAtRestType, + EnhancedSecurityState, + FabricName, + HealthState, + HealthStatus, + HttpStatusCode, + IAASVMPolicyType, + IaasVMSnapshotConsistencyType, + InfrastructureEncryptionState, + InquiryStatus, + IntentItemType, + JobOperationType, + JobStatus, + JobSupportedAction, + LastBackupStatus, + LastUpdateStatus, + MabServerType, + MonthOfYear, + OperationStatusValues, + OperationType, + OverwriteOptions, + PolicyType, + PrivateEndpointConnectionStatus, + ProtectableContainerType, + ProtectedItemHealthStatus, + ProtectedItemState, + ProtectionIntentItemType, + ProtectionState, + ProtectionStatus, + ProvisioningState, + RecoveryMode, + RecoveryPointTierStatus, + RecoveryPointTierType, + RecoveryType, + RehydrationPriority, + ResourceHealthStatus, + RestorePointQueryType, + RestorePointType, + RestoreRequestType, + RetentionDurationType, + RetentionScheduleFormat, + SQLDataDirectoryType, + ScheduleRunType, + SoftDeleteFeatureState, + StorageType, + StorageTypeState, + SupportStatus, + TargetDiskNetworkAccessOption, + TieringMode, + Type, + UsagesUnit, + ValidationStatus, + VaultSubResourceType, + WeekOfMonth, + WorkloadItemType, + WorkloadType, + XcoolState, +) from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -779,5 +790,5 @@ "WorkloadType", "XcoolState", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/models/_models_py3.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/models/_models_py3.py index 991551d8e9ed..bcf7f4dbbb29 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/models/_models_py3.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/models/_models_py3.py @@ -1,5 +1,5 @@ -# coding=utf-8 # pylint: disable=too-many-lines +# 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. @@ -13,7 +13,6 @@ from .. import _serialization if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from .. import models as _models @@ -174,7 +173,7 @@ def __init__( self.protectable_object_type = protectable_object_type -class DpmContainer(ProtectionContainer): # pylint: disable=too-many-instance-attributes +class DpmContainer(ProtectionContainer): """DPM workload-specific protection container. You probably want to use the sub-classes and not this class directly. Known sub-classes are: @@ -323,7 +322,7 @@ def __init__( self.extended_info = extended_info -class AzureBackupServerContainer(DpmContainer): # pylint: disable=too-many-instance-attributes +class AzureBackupServerContainer(DpmContainer): """AzureBackupServer (DPMVenus) workload-specific protection container. All required parameters must be populated in order to send to server. @@ -467,7 +466,7 @@ def __init__( self.container_type: str = "AzureBackupServerContainer" -class BackupEngineBase(_serialization.Model): # pylint: disable=too-many-instance-attributes +class BackupEngineBase(_serialization.Model): """The base backup engine class. All workload specific backup engines derive from this class. You probably want to use the sub-classes and not this class directly. Known sub-classes are: @@ -605,7 +604,7 @@ def __init__( self.extended_info = extended_info -class AzureBackupServerEngine(BackupEngineBase): # pylint: disable=too-many-instance-attributes +class AzureBackupServerEngine(BackupEngineBase): """Backup engine type when Azure Backup Server is used to manage the backups. All required parameters must be populated in order to send to server. @@ -965,7 +964,7 @@ def __init__( self.azure_file_share_type = azure_file_share_type -class ProtectedItem(_serialization.Model): # pylint: disable=too-many-instance-attributes +class ProtectedItem(_serialization.Model): """Base class for backup items. You probably want to use the sub-classes and not this class directly. Known sub-classes are: @@ -1151,7 +1150,7 @@ def __init__( self.vault_id = None -class AzureFileshareProtectedItem(ProtectedItem): # pylint: disable=too-many-instance-attributes +class AzureFileshareProtectedItem(ProtectedItem): """Azure File Share workload-specific backup item. Variables are only populated by the server, and will be ignored when sending a request. @@ -2322,7 +2321,7 @@ def __init__( self.protectable_item_type: str = "Microsoft.ClassicCompute/virtualMachines" -class AzureIaaSVMProtectedItem(ProtectedItem): # pylint: disable=too-many-instance-attributes +class AzureIaaSVMProtectedItem(ProtectedItem): """IaaS VM workload-specific backup item. You probably want to use the sub-classes and not this class directly. Known sub-classes are: @@ -2592,7 +2591,7 @@ def __init__( # pylint: disable=too-many-locals self.extended_properties = extended_properties -class AzureIaaSClassicComputeVMProtectedItem(AzureIaaSVMProtectedItem): # pylint: disable=too-many-instance-attributes +class AzureIaaSClassicComputeVMProtectedItem(AzureIaaSVMProtectedItem): """IaaS VM workload-specific backup item representing the Classic Compute VM. Variables are only populated by the server, and will be ignored when sending a request. @@ -3043,7 +3042,7 @@ def __init__( self.protectable_item_type: str = "Microsoft.Compute/virtualMachines" -class AzureIaaSComputeVMProtectedItem(AzureIaaSVMProtectedItem): # pylint: disable=too-many-instance-attributes +class AzureIaaSComputeVMProtectedItem(AzureIaaSVMProtectedItem): """IaaS VM workload-specific backup item representing the Azure Resource Manager VM. Variables are only populated by the server, and will be ignored when sending a request. @@ -3490,7 +3489,7 @@ def __init__( self.job_type: Optional[str] = None -class AzureIaaSVMJob(Job): # pylint: disable=too-many-instance-attributes +class AzureIaaSVMJob(Job): """Azure IaaS VM workload-specific job object. All required parameters must be populated in order to send to server. @@ -3774,7 +3773,7 @@ def __init__( self.task_execution_details = task_execution_details -class AzureIaaSVMJobV2(Job): # pylint: disable=too-many-instance-attributes +class AzureIaaSVMJobV2(Job): """Azure IaaS VM workload-specific job object. All required parameters must be populated in order to send to server. @@ -3981,7 +3980,7 @@ def __init__( self.policy_inconsistent = policy_inconsistent -class AzureIaaSVMProtectionPolicy(ProtectionPolicy): # pylint: disable=too-many-instance-attributes +class AzureIaaSVMProtectionPolicy(ProtectionPolicy): """IaaS VM workload-specific backup policy. All required parameters must be populated in order to send to server. @@ -4366,7 +4365,7 @@ def __init__( self.friendly_name = friendly_name -class AzureWorkloadContainer(ProtectionContainer): # pylint: disable=too-many-instance-attributes +class AzureWorkloadContainer(ProtectionContainer): """Container for the workloads running inside Azure Compute or Classic Compute. You probably want to use the sub-classes and not this class directly. Known sub-classes are: @@ -4513,9 +4512,7 @@ def __init__( self.operation_type = operation_type -class AzureSQLAGWorkloadContainerProtectionContainer( - AzureWorkloadContainer -): # pylint: disable=too-many-instance-attributes,name-too-long +class AzureSQLAGWorkloadContainerProtectionContainer(AzureWorkloadContainer): # pylint: disable=name-too-long """Container for SQL workloads under SQL Availability Group. All required parameters must be populated in order to send to server. @@ -4738,7 +4735,7 @@ def __init__( self.container_type: str = "AzureSqlContainer" -class AzureSqlProtectedItem(ProtectedItem): # pylint: disable=too-many-instance-attributes +class AzureSqlProtectedItem(ProtectedItem): """Azure SQL workload-specific backup item. Variables are only populated by the server, and will be ignored when sending a request. @@ -5032,7 +5029,7 @@ def __init__( self.retention_policy = retention_policy -class AzureStorageContainer(ProtectionContainer): # pylint: disable=too-many-instance-attributes +class AzureStorageContainer(ProtectionContainer): """Azure Storage Account workload-specific container. All required parameters must be populated in order to send to server. @@ -5196,7 +5193,7 @@ def __init__( self.recommendations = recommendations -class AzureStorageJob(Job): # pylint: disable=too-many-instance-attributes +class AzureStorageJob(Job): """Azure storage specific job. All required parameters must be populated in order to send to server. @@ -5637,7 +5634,7 @@ def __init__( self.protectable_container_type: str = "VMAppContainer" -class AzureVMAppContainerProtectionContainer(AzureWorkloadContainer): # pylint: disable=too-many-instance-attributes +class AzureVMAppContainerProtectionContainer(AzureWorkloadContainer): """Container for SQL workloads under Azure Virtual Machines. All required parameters must be populated in order to send to server. @@ -6012,7 +6009,7 @@ def __init__( self.sub_workload_item_count = sub_workload_item_count -class AzureVmWorkloadProtectableItem(WorkloadProtectableItem): # pylint: disable=too-many-instance-attributes +class AzureVmWorkloadProtectableItem(WorkloadProtectableItem): """Azure VM workload-specific protectable item. You probably want to use the sub-classes and not this class directly. Known sub-classes are: @@ -6163,7 +6160,7 @@ def __init__( self.is_protectable = is_protectable -class AzureVmWorkloadProtectedItem(ProtectedItem): # pylint: disable=too-many-instance-attributes +class AzureVmWorkloadProtectedItem(ProtectedItem): """Azure VM workload-specific protected item. You probably want to use the sub-classes and not this class directly. Known sub-classes are: @@ -6629,9 +6626,7 @@ def __init__( self.make_policy_consistent = make_policy_consistent -class AzureVmWorkloadSAPAseDatabaseProtectedItem( - AzureVmWorkloadProtectedItem -): # pylint: disable=too-many-instance-attributes,name-too-long +class AzureVmWorkloadSAPAseDatabaseProtectedItem(AzureVmWorkloadProtectedItem): # pylint: disable=name-too-long """Azure VM workload-specific protected item representing SAP ASE Database. Variables are only populated by the server, and will be ignored when sending a request. @@ -7015,9 +7010,7 @@ def __init__( self.workload_item_type: str = "SAPAseDatabase" -class AzureVmWorkloadSAPAseSystemProtectableItem( - AzureVmWorkloadProtectableItem -): # pylint: disable=too-many-instance-attributes,name-too-long +class AzureVmWorkloadSAPAseSystemProtectableItem(AzureVmWorkloadProtectableItem): # pylint: disable=name-too-long """Azure VM workload-specific protectable item representing SAP ASE System. All required parameters must be populated in order to send to server. @@ -7245,9 +7238,7 @@ def __init__( self.workload_item_type: str = "SAPAseSystem" -class AzureVmWorkloadSAPHanaDatabaseProtectableItem( - AzureVmWorkloadProtectableItem -): # pylint: disable=too-many-instance-attributes,name-too-long +class AzureVmWorkloadSAPHanaDatabaseProtectableItem(AzureVmWorkloadProtectableItem): # pylint: disable=name-too-long """Azure VM workload-specific protectable item representing SAP HANA Database. All required parameters must be populated in order to send to server. @@ -7378,9 +7369,7 @@ def __init__( self.protectable_item_type: str = "SAPHanaDatabase" -class AzureVmWorkloadSAPHanaDatabaseProtectedItem( - AzureVmWorkloadProtectedItem -): # pylint: disable=too-many-instance-attributes,name-too-long +class AzureVmWorkloadSAPHanaDatabaseProtectedItem(AzureVmWorkloadProtectedItem): # pylint: disable=name-too-long """Azure VM workload-specific protected item representing SAP HANA Database. Variables are only populated by the server, and will be ignored when sending a request. @@ -7764,7 +7753,7 @@ def __init__( self.workload_item_type: str = "SAPHanaDatabase" -class AzureVmWorkloadSAPHanaDBInstance(AzureVmWorkloadProtectableItem): # pylint: disable=too-many-instance-attributes +class AzureVmWorkloadSAPHanaDBInstance(AzureVmWorkloadProtectableItem): """Azure VM workload-specific protectable item representing SAP HANA Dbinstance. All required parameters must be populated in order to send to server. @@ -7895,9 +7884,7 @@ def __init__( self.protectable_item_type: str = "SAPHanaDBInstance" -class AzureVmWorkloadSAPHanaDBInstanceProtectedItem( - AzureVmWorkloadProtectedItem -): # pylint: disable=too-many-instance-attributes,name-too-long +class AzureVmWorkloadSAPHanaDBInstanceProtectedItem(AzureVmWorkloadProtectedItem): # pylint: disable=name-too-long """Azure VM workload-specific protected item representing SAP HANA DBInstance. Variables are only populated by the server, and will be ignored when sending a request. @@ -8184,9 +8171,7 @@ def __init__( # pylint: disable=too-many-locals self.protected_item_type: str = "AzureVmWorkloadSAPHanaDBInstance" -class AzureVmWorkloadSAPHanaHSRProtectableItem( - AzureVmWorkloadProtectableItem -): # pylint: disable=too-many-instance-attributes +class AzureVmWorkloadSAPHanaHSRProtectableItem(AzureVmWorkloadProtectableItem): """Azure VM workload-specific protectable item representing HANA HSR. All required parameters must be populated in order to send to server. @@ -8317,9 +8302,7 @@ def __init__( self.protectable_item_type: str = "HanaHSRContainer" -class AzureVmWorkloadSAPHanaSystemProtectableItem( - AzureVmWorkloadProtectableItem -): # pylint: disable=too-many-instance-attributes,name-too-long +class AzureVmWorkloadSAPHanaSystemProtectableItem(AzureVmWorkloadProtectableItem): # pylint: disable=name-too-long """Azure VM workload-specific protectable item representing SAP HANA System. All required parameters must be populated in order to send to server. @@ -8549,7 +8532,7 @@ def __init__( class AzureVmWorkloadSQLAvailabilityGroupProtectableItem( AzureVmWorkloadProtectableItem -): # pylint: disable=too-many-instance-attributes,name-too-long +): # pylint: disable=name-too-long """Azure VM workload-specific protectable item representing SQL Availability Group. All required parameters must be populated in order to send to server. @@ -8689,9 +8672,7 @@ def __init__( self.nodes_list = nodes_list -class AzureVmWorkloadSQLDatabaseProtectableItem( - AzureVmWorkloadProtectableItem -): # pylint: disable=too-many-instance-attributes,name-too-long +class AzureVmWorkloadSQLDatabaseProtectableItem(AzureVmWorkloadProtectableItem): # pylint: disable=name-too-long """Azure VM workload-specific protectable item representing SQL Database. All required parameters must be populated in order to send to server. @@ -8822,9 +8803,7 @@ def __init__( self.protectable_item_type: str = "SQLDataBase" -class AzureVmWorkloadSQLDatabaseProtectedItem( - AzureVmWorkloadProtectedItem -): # pylint: disable=too-many-instance-attributes +class AzureVmWorkloadSQLDatabaseProtectedItem(AzureVmWorkloadProtectedItem): """Azure VM workload-specific protected item representing SQL Database. Variables are only populated by the server, and will be ignored when sending a request. @@ -9208,9 +9187,7 @@ def __init__( self.workload_item_type: str = "SQLDataBase" -class AzureVmWorkloadSQLInstanceProtectableItem( - AzureVmWorkloadProtectableItem -): # pylint: disable=too-many-instance-attributes,name-too-long +class AzureVmWorkloadSQLInstanceProtectableItem(AzureVmWorkloadProtectableItem): # pylint: disable=name-too-long """Azure VM workload-specific protectable item representing SQL Instance. All required parameters must be populated in order to send to server. @@ -9341,7 +9318,7 @@ def __init__( self.protectable_item_type: str = "SQLInstance" -class AzureVmWorkloadSQLInstanceWorkloadItem(AzureVmWorkloadItem): # pylint: disable=too-many-instance-attributes +class AzureVmWorkloadSQLInstanceWorkloadItem(AzureVmWorkloadItem): """Azure VM workload-specific workload item representing SQL Instance. All required parameters must be populated in order to send to server. @@ -9768,7 +9745,7 @@ def __init__( self.additional_details = additional_details -class AzureWorkloadJob(Job): # pylint: disable=too-many-instance-attributes +class AzureWorkloadJob(Job): """Azure storage specific job. All required parameters must be populated in order to send to server. @@ -10143,7 +10120,7 @@ def __init__( self.time_ranges = time_ranges -class AzureWorkloadRestoreRequest(RestoreRequest): # pylint: disable=too-many-instance-attributes +class AzureWorkloadRestoreRequest(RestoreRequest): """AzureWorkload-specific restore. You probably want to use the sub-classes and not this class directly. Known sub-classes are: @@ -10282,9 +10259,7 @@ def __init__( self.target_virtual_machine_id = target_virtual_machine_id -class AzureWorkloadPointInTimeRestoreRequest( - AzureWorkloadRestoreRequest -): # pylint: disable=too-many-instance-attributes +class AzureWorkloadPointInTimeRestoreRequest(AzureWorkloadRestoreRequest): """AzureWorkload SAP Hana -specific restore. Specifically for PointInTime/Log restore. All required parameters must be populated in order to send to server. @@ -10509,7 +10484,7 @@ def __init__( self.object_type: str = "AzureWorkloadSAPHanaPointInTimeRecoveryPoint" -class AzureWorkloadSAPHanaRestoreRequest(AzureWorkloadRestoreRequest): # pylint: disable=too-many-instance-attributes +class AzureWorkloadSAPHanaRestoreRequest(AzureWorkloadRestoreRequest): """AzureWorkload SAP Hana-specific restore. You probably want to use the sub-classes and not this class directly. Known sub-classes are: @@ -10651,7 +10626,7 @@ def __init__( class AzureWorkloadSAPHanaPointInTimeRestoreRequest( AzureWorkloadSAPHanaRestoreRequest -): # pylint: disable=too-many-instance-attributes,name-too-long +): # pylint: disable=name-too-long """AzureWorkload SAP Hana -specific restore. Specifically for PointInTime/Log restore. You probably want to use the sub-classes and not this class directly. Known sub-classes are: @@ -10799,7 +10774,7 @@ def __init__( class AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest( AzureWorkloadSAPHanaPointInTimeRestoreRequest -): # pylint: disable=too-many-instance-attributes,name-too-long +): # pylint: disable=name-too-long """AzureWorkload SAP Hana-specific restore with integrated rehydration of recovery point. All required parameters must be populated in order to send to server. @@ -11027,7 +11002,7 @@ def __init__( class AzureWorkloadSAPHanaRestoreWithRehydrateRequest( AzureWorkloadSAPHanaRestoreRequest -): # pylint: disable=too-many-instance-attributes,name-too-long +): # pylint: disable=name-too-long """AzureWorkload SAP Hana-specific restore with integrated rehydration of recovery point. All required parameters must be populated in order to send to server. @@ -11464,7 +11439,7 @@ def __init__( self.time_ranges = time_ranges -class AzureWorkloadSQLRestoreRequest(AzureWorkloadRestoreRequest): # pylint: disable=too-many-instance-attributes +class AzureWorkloadSQLRestoreRequest(AzureWorkloadRestoreRequest): """AzureWorkload SQL -specific restore. Specifically for full/diff restore. You probably want to use the sub-classes and not this class directly. Known sub-classes are: @@ -11631,9 +11606,7 @@ def __init__( self.alternate_directory_paths = alternate_directory_paths -class AzureWorkloadSQLPointInTimeRestoreRequest( - AzureWorkloadSQLRestoreRequest -): # pylint: disable=too-many-instance-attributes,name-too-long +class AzureWorkloadSQLPointInTimeRestoreRequest(AzureWorkloadSQLRestoreRequest): # pylint: disable=name-too-long """AzureWorkload SQL -specific restore. Specifically for PointInTime/Log restore. You probably want to use the sub-classes and not this class directly. Known sub-classes are: @@ -11808,7 +11781,7 @@ def __init__( class AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest( AzureWorkloadSQLPointInTimeRestoreRequest -): # pylint: disable=too-many-instance-attributes,name-too-long +): # pylint: disable=name-too-long """AzureWorkload SQL-specific restore with integrated rehydration of recovery point. All required parameters must be populated in order to send to server. @@ -12018,9 +11991,7 @@ def __init__( self.data_directory_paths = data_directory_paths -class AzureWorkloadSQLRestoreWithRehydrateRequest( - AzureWorkloadSQLRestoreRequest -): # pylint: disable=too-many-instance-attributes,name-too-long +class AzureWorkloadSQLRestoreWithRehydrateRequest(AzureWorkloadSQLRestoreRequest): # pylint: disable=name-too-long """AzureWorkload SQL-specific restore with integrated rehydration of recovery point. All required parameters must be populated in order to send to server. @@ -13200,7 +13171,7 @@ def __init__( self.po_logical_name = po_logical_name -class BackupStatusResponse(_serialization.Model): # pylint: disable=too-many-instance-attributes +class BackupStatusResponse(_serialization.Model): """BackupStatus response. :ivar protection_status: Specifies whether the container is registered or not. Known values @@ -14375,7 +14346,7 @@ def __init__( self.source_resource_id = source_resource_id -class DpmBackupEngine(BackupEngineBase): # pylint: disable=too-many-instance-attributes +class DpmBackupEngine(BackupEngineBase): """Data Protection Manager (DPM) specific backup engine. All required parameters must be populated in order to send to server. @@ -14553,7 +14524,7 @@ def __init__( self.recommendations = recommendations -class DpmJob(Job): # pylint: disable=too-many-instance-attributes +class DpmJob(Job): """DPM workload-specific job object. All required parameters must be populated in order to send to server. @@ -14796,7 +14767,7 @@ def __init__( self.status = status -class DPMProtectedItem(ProtectedItem): # pylint: disable=too-many-instance-attributes +class DPMProtectedItem(ProtectedItem): """Additional information on Backup engine specific backup item. Variables are only populated by the server, and will be ignored when sending a request. @@ -15001,7 +14972,7 @@ def __init__( self.extended_info = extended_info -class DPMProtectedItemExtendedInfo(_serialization.Model): # pylint: disable=too-many-instance-attributes +class DPMProtectedItemExtendedInfo(_serialization.Model): """Additional information of DPM Protected item. :ivar protectable_object_load_path: Attribute to provide information on various DBs. @@ -15863,7 +15834,7 @@ def __init__( self.service_endpoints = service_endpoints -class GenericProtectedItem(ProtectedItem): # pylint: disable=too-many-instance-attributes +class GenericProtectedItem(ProtectedItem): """Base class for backup items. Variables are only populated by the server, and will be ignored when sending a request. @@ -16380,7 +16351,7 @@ def __init__( self.renew_existing_registration = renew_existing_registration -class IaasVMRecoveryPoint(RecoveryPoint): # pylint: disable=too-many-instance-attributes +class IaasVMRecoveryPoint(RecoveryPoint): """IaaS VM workload specific backup copy. All required parameters must be populated in order to send to server. @@ -16573,7 +16544,7 @@ def __init__( self.extended_location = extended_location -class IaasVMRestoreRequest(RestoreRequest): # pylint: disable=too-many-instance-attributes +class IaasVMRestoreRequest(RestoreRequest): """IaaS VM workload-specific restore. You probably want to use the sub-classes and not this class directly. Known sub-classes are: @@ -16836,7 +16807,7 @@ def __init__( # pylint: disable=too-many-locals self.target_disk_network_access_settings = target_disk_network_access_settings -class IaasVMRestoreWithRehydrationRequest(IaasVMRestoreRequest): # pylint: disable=too-many-instance-attributes +class IaasVMRestoreWithRehydrationRequest(IaasVMRestoreRequest): """IaaS VM workload-specific restore with integrated rehydration of recovery point. All required parameters must be populated in order to send to server. @@ -17889,7 +17860,7 @@ def __init__(self, **kwargs: Any) -> None: self.schedule_policy_type: str = "LongTermSchedulePolicy" -class MabContainer(ProtectionContainer): # pylint: disable=too-many-instance-attributes +class MabContainer(ProtectionContainer): """Container with items backed up using MAB backup engine. All required parameters must be populated in order to send to server. @@ -18163,7 +18134,7 @@ def __init__(self, **kwargs: Any) -> None: self.recommendations = None -class MabFileFolderProtectedItem(ProtectedItem): # pylint: disable=too-many-instance-attributes +class MabFileFolderProtectedItem(ProtectedItem): """MAB workload-specific backup item. Variables are only populated by the server, and will be ignored when sending a request. @@ -18422,7 +18393,7 @@ def __init__( self.recovery_point_count = recovery_point_count -class MabJob(Job): # pylint: disable=too-many-instance-attributes +class MabJob(Job): """MAB workload-specific job. All required parameters must be populated in order to send to server. @@ -22458,7 +22429,7 @@ def __init__( self.validate_operation_response = validate_operation_response -class VaultJob(Job): # pylint: disable=too-many-instance-attributes +class VaultJob(Job): """Vault level Job. All required parameters must be populated in order to send to server. diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/__init__.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/__init__.py index 29071c5cf960..634b1b06bf96 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/__init__.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/__init__.py @@ -5,65 +5,69 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._backup_resource_storage_configs_non_crr_operations import BackupResourceStorageConfigsNonCRROperations -from ._protection_intent_operations import ProtectionIntentOperations -from ._backup_status_operations import BackupStatusOperations -from ._feature_support_operations import FeatureSupportOperations -from ._backup_protection_intent_operations import BackupProtectionIntentOperations -from ._backup_usage_summaries_operations import BackupUsageSummariesOperations -from ._operations import Operations -from ._backup_resource_vault_configs_operations import BackupResourceVaultConfigsOperations -from ._backup_resource_encryption_configs_operations import BackupResourceEncryptionConfigsOperations -from ._private_endpoint_connection_operations import PrivateEndpointConnectionOperations -from ._private_endpoint_operations import PrivateEndpointOperations -from ._recovery_services_backup_client_operations import RecoveryServicesBackupClientOperationsMixin -from ._bms_prepare_data_move_operation_result_operations import BMSPrepareDataMoveOperationResultOperations -from ._protected_items_operations import ProtectedItemsOperations -from ._protected_item_operation_results_operations import ProtectedItemOperationResultsOperations -from ._recovery_points_operations import RecoveryPointsOperations -from ._restores_operations import RestoresOperations -from ._backup_policies_operations import BackupPoliciesOperations -from ._protection_policies_operations import ProtectionPoliciesOperations -from ._protection_policy_operation_results_operations import ProtectionPolicyOperationResultsOperations -from ._backup_jobs_operations import BackupJobsOperations -from ._job_details_operations import JobDetailsOperations -from ._job_cancellations_operations import JobCancellationsOperations -from ._job_operation_results_operations import JobOperationResultsOperations -from ._export_jobs_operation_results_operations import ExportJobsOperationResultsOperations -from ._jobs_operations import JobsOperations -from ._backup_protected_items_operations import BackupProtectedItemsOperations -from ._operation_operations import OperationOperations -from ._validate_operation_operations import ValidateOperationOperations -from ._validate_operation_results_operations import ValidateOperationResultsOperations -from ._validate_operation_statuses_operations import ValidateOperationStatusesOperations -from ._backup_engines_operations import BackupEnginesOperations -from ._protection_container_refresh_operation_results_operations import ( - ProtectionContainerRefreshOperationResultsOperations, -) -from ._protectable_containers_operations import ProtectableContainersOperations -from ._protection_containers_operations import ProtectionContainersOperations -from ._backup_workload_items_operations import BackupWorkloadItemsOperations -from ._protection_container_operation_results_operations import ProtectionContainerOperationResultsOperations -from ._backups_operations import BackupsOperations -from ._protected_item_operation_statuses_operations import ProtectedItemOperationStatusesOperations -from ._item_level_recovery_connections_operations import ItemLevelRecoveryConnectionsOperations -from ._backup_operation_results_operations import BackupOperationResultsOperations -from ._backup_operation_statuses_operations import BackupOperationStatusesOperations -from ._protection_policy_operation_statuses_operations import ProtectionPolicyOperationStatusesOperations -from ._backup_protectable_items_operations import BackupProtectableItemsOperations -from ._backup_protection_containers_operations import BackupProtectionContainersOperations -from ._deleted_protection_containers_operations import DeletedProtectionContainersOperations -from ._security_pins_operations import SecurityPINsOperations -from ._recovery_points_recommended_for_move_operations import RecoveryPointsRecommendedForMoveOperations -from ._resource_guard_proxies_operations import ResourceGuardProxiesOperations -from ._resource_guard_proxy_operations import ResourceGuardProxyOperations -from ._fetch_tiering_cost_operations import FetchTieringCostOperations -from ._get_tiering_cost_operation_result_operations import GetTieringCostOperationResultOperations -from ._tiering_cost_operation_status_operations import TieringCostOperationStatusOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._backup_resource_storage_configs_non_crr_operations import BackupResourceStorageConfigsNonCRROperations # type: ignore +from ._protection_intent_operations import ProtectionIntentOperations # type: ignore +from ._backup_status_operations import BackupStatusOperations # type: ignore +from ._feature_support_operations import FeatureSupportOperations # type: ignore +from ._backup_protection_intent_operations import BackupProtectionIntentOperations # type: ignore +from ._backup_usage_summaries_operations import BackupUsageSummariesOperations # type: ignore +from ._operations import Operations # type: ignore +from ._backup_resource_vault_configs_operations import BackupResourceVaultConfigsOperations # type: ignore +from ._backup_resource_encryption_configs_operations import BackupResourceEncryptionConfigsOperations # type: ignore +from ._private_endpoint_connection_operations import PrivateEndpointConnectionOperations # type: ignore +from ._private_endpoint_operations import PrivateEndpointOperations # type: ignore +from ._recovery_services_backup_client_operations import RecoveryServicesBackupClientOperationsMixin # type: ignore +from ._bms_prepare_data_move_operation_result_operations import BMSPrepareDataMoveOperationResultOperations # type: ignore +from ._protected_items_operations import ProtectedItemsOperations # type: ignore +from ._protected_item_operation_results_operations import ProtectedItemOperationResultsOperations # type: ignore +from ._recovery_points_operations import RecoveryPointsOperations # type: ignore +from ._restores_operations import RestoresOperations # type: ignore +from ._backup_policies_operations import BackupPoliciesOperations # type: ignore +from ._protection_policies_operations import ProtectionPoliciesOperations # type: ignore +from ._protection_policy_operation_results_operations import ProtectionPolicyOperationResultsOperations # type: ignore +from ._backup_jobs_operations import BackupJobsOperations # type: ignore +from ._job_details_operations import JobDetailsOperations # type: ignore +from ._job_cancellations_operations import JobCancellationsOperations # type: ignore +from ._job_operation_results_operations import JobOperationResultsOperations # type: ignore +from ._export_jobs_operation_results_operations import ExportJobsOperationResultsOperations # type: ignore +from ._jobs_operations import JobsOperations # type: ignore +from ._backup_protected_items_operations import BackupProtectedItemsOperations # type: ignore +from ._operation_operations import OperationOperations # type: ignore +from ._validate_operation_operations import ValidateOperationOperations # type: ignore +from ._validate_operation_results_operations import ValidateOperationResultsOperations # type: ignore +from ._validate_operation_statuses_operations import ValidateOperationStatusesOperations # type: ignore +from ._backup_engines_operations import BackupEnginesOperations # type: ignore +from ._protection_container_refresh_operation_results_operations import ProtectionContainerRefreshOperationResultsOperations # type: ignore +from ._protectable_containers_operations import ProtectableContainersOperations # type: ignore +from ._protection_containers_operations import ProtectionContainersOperations # type: ignore +from ._backup_workload_items_operations import BackupWorkloadItemsOperations # type: ignore +from ._protection_container_operation_results_operations import ProtectionContainerOperationResultsOperations # type: ignore +from ._backups_operations import BackupsOperations # type: ignore +from ._protected_item_operation_statuses_operations import ProtectedItemOperationStatusesOperations # type: ignore +from ._item_level_recovery_connections_operations import ItemLevelRecoveryConnectionsOperations # type: ignore +from ._backup_operation_results_operations import BackupOperationResultsOperations # type: ignore +from ._backup_operation_statuses_operations import BackupOperationStatusesOperations # type: ignore +from ._protection_policy_operation_statuses_operations import ProtectionPolicyOperationStatusesOperations # type: ignore +from ._backup_protectable_items_operations import BackupProtectableItemsOperations # type: ignore +from ._backup_protection_containers_operations import BackupProtectionContainersOperations # type: ignore +from ._deleted_protection_containers_operations import DeletedProtectionContainersOperations # type: ignore +from ._security_pins_operations import SecurityPINsOperations # type: ignore +from ._recovery_points_recommended_for_move_operations import RecoveryPointsRecommendedForMoveOperations # type: ignore +from ._resource_guard_proxies_operations import ResourceGuardProxiesOperations # type: ignore +from ._resource_guard_proxy_operations import ResourceGuardProxyOperations # type: ignore +from ._fetch_tiering_cost_operations import FetchTieringCostOperations # type: ignore +from ._get_tiering_cost_operation_result_operations import GetTieringCostOperationResultOperations # type: ignore +from ._tiering_cost_operation_status_operations import TieringCostOperationStatusOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -121,5 +125,5 @@ "GetTieringCostOperationResultOperations", "TieringCostOperationStatusOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_engines_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_engines_operations.py index 750ef85acbee..a8a00929f3cc 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_engines_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_engines_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -19,16 +19,18 @@ ) 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.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -172,7 +174,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BackupEngineBaseResourceList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -193,7 +195,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -209,7 +210,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -265,7 +265,7 @@ def get( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupEngineBaseResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -290,7 +290,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -304,7 +303,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupEngineBaseResource", pipeline_response) + deserialized = self._deserialize("BackupEngineBaseResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_jobs_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_jobs_operations.py index 53353aeef9fb..01439a742efc 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_jobs_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_jobs_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -19,16 +19,18 @@ ) 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.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -127,7 +129,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -148,7 +150,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -164,7 +165,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_operation_results_operations.py index 932b77ad5aba..00047393bf55 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_operation_results_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -17,16 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -108,7 +110,7 @@ def get( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -131,7 +133,6 @@ def get( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_operation_statuses_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_operation_statuses_operations.py index 6f6e1dbd1d49..fe862d08a2ee 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_operation_statuses_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_operation_statuses_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -17,16 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -106,7 +108,7 @@ def get( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.OperationStatus :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -129,7 +131,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -143,7 +144,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("OperationStatus", pipeline_response) + deserialized = self._deserialize("OperationStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_policies_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_policies_operations.py index 0baae2b242ec..3626a6b0f4e5 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_policies_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -19,16 +19,18 @@ ) 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.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -115,7 +117,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ProtectionPolicyResourceList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -135,7 +137,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -151,7 +152,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protectable_items_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protectable_items_operations.py index c4c07f759b72..e3c74152df44 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protectable_items_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protectable_items_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -19,16 +19,18 @@ ) 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.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -105,6 +107,7 @@ def list( skip_token: Optional[str] = None, **kwargs: Any ) -> Iterable["_models.WorkloadProtectableItemResource"]: + # pylint: disable=line-too-long """Provides a pageable list of protectable objects within your subscription according to the query filter and the pagination parameters. @@ -130,7 +133,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.WorkloadProtectableItemResourceList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -151,7 +154,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -167,7 +169,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protected_items_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protected_items_operations.py index 215d714e7f7c..4e35c713b596 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protected_items_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protected_items_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -19,16 +19,18 @@ ) 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.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -128,7 +130,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ProtectedItemResourceList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -149,7 +151,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -165,7 +166,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protection_containers_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protection_containers_operations.py index afdd97cfc5fe..8f87f45ea024 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protection_containers_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protection_containers_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -19,16 +19,18 @@ ) 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.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -113,7 +115,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ProtectionContainerResourceList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -133,7 +135,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -149,7 +150,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protection_intent_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protection_intent_operations.py index 03f4d4303bc8..0a0883392ec0 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protection_intent_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protection_intent_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -19,16 +19,18 @@ ) 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.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -128,7 +130,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ProtectionIntentResourceList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -149,7 +151,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -165,7 +166,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_resource_encryption_configs_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_resource_encryption_configs_operations.py index 037cf9834897..df8c58c94212 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_resource_encryption_configs_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_resource_encryption_configs_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -18,16 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -131,7 +133,7 @@ def get( ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceEncryptionConfigExtendedResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -153,7 +155,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -168,7 +169,9 @@ def get( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupResourceEncryptionConfigExtendedResource", pipeline_response) + deserialized = self._deserialize( + "BackupResourceEncryptionConfigExtendedResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -176,7 +179,7 @@ def get( return deserialized # type: ignore @overload - def update( # pylint: disable=inconsistent-return-statements + def update( self, vault_name: str, resource_group_name: str, @@ -204,7 +207,7 @@ def update( # pylint: disable=inconsistent-return-statements """ @overload - def update( # pylint: disable=inconsistent-return-statements + def update( self, vault_name: str, resource_group_name: str, @@ -254,7 +257,7 @@ def update( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -288,7 +291,6 @@ def update( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_resource_storage_configs_non_crr_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_resource_storage_configs_non_crr_operations.py index e876cdc129a0..9ad4aabca9d2 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_resource_storage_configs_non_crr_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_resource_storage_configs_non_crr_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -18,16 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -160,7 +162,7 @@ def get(self, vault_name: str, resource_group_name: str, **kwargs: Any) -> _mode :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceConfigResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -182,7 +184,6 @@ def get(self, vault_name: str, resource_group_name: str, **kwargs: Any) -> _mode headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -197,7 +198,7 @@ def get(self, vault_name: str, resource_group_name: str, **kwargs: Any) -> _mode error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupResourceConfigResource", pipeline_response) + deserialized = self._deserialize("BackupResourceConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -282,7 +283,7 @@ def update( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceConfigResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -316,7 +317,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -331,7 +331,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupResourceConfigResource", pipeline_response) + deserialized = self._deserialize("BackupResourceConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -339,7 +339,7 @@ def update( return deserialized # type: ignore @overload - def patch( # pylint: disable=inconsistent-return-statements + def patch( self, vault_name: str, resource_group_name: str, @@ -367,7 +367,7 @@ def patch( # pylint: disable=inconsistent-return-statements """ @overload - def patch( # pylint: disable=inconsistent-return-statements + def patch( self, vault_name: str, resource_group_name: str, @@ -416,7 +416,7 @@ def patch( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -450,7 +450,6 @@ def patch( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_resource_vault_configs_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_resource_vault_configs_operations.py index 1db13506d133..7bad224558c3 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_resource_vault_configs_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_resource_vault_configs_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -18,16 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -184,7 +186,7 @@ def get( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceVaultConfigResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -206,7 +208,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -221,7 +222,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupResourceVaultConfigResource", pipeline_response) + deserialized = self._deserialize("BackupResourceVaultConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -316,7 +317,7 @@ def update( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceVaultConfigResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -351,7 +352,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -366,7 +366,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupResourceVaultConfigResource", pipeline_response) + deserialized = self._deserialize("BackupResourceVaultConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -461,7 +461,7 @@ def put( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceVaultConfigResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -496,7 +496,6 @@ def put( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -511,7 +510,7 @@ def put( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupResourceVaultConfigResource", pipeline_response) + deserialized = self._deserialize("BackupResourceVaultConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_status_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_status_operations.py index 5666d806acb6..a289bef18670 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_status_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_status_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -18,16 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -148,7 +150,7 @@ def get( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupStatusResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -181,7 +183,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -195,7 +196,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupStatusResponse", pipeline_response) + deserialized = self._deserialize("BackupStatusResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_usage_summaries_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_usage_summaries_operations.py index 88cd9bf85652..aad159faa441 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_usage_summaries_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_usage_summaries_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -19,16 +19,18 @@ ) 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.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -128,7 +130,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BackupManagementUsageList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -149,7 +151,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -165,7 +166,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_workload_items_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_workload_items_operations.py index a3f4dc9a9a74..0e3702a267e9 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_workload_items_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_workload_items_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -19,16 +19,18 @@ ) 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.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -140,7 +142,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.WorkloadItemResourceList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -163,7 +165,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -179,7 +180,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backups_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backups_operations.py index ba7db2e2db89..3effd6fc73cd 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backups_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backups_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -18,16 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -98,7 +100,7 @@ def __init__(self, *args, **kwargs): self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @overload - def trigger( # pylint: disable=inconsistent-return-statements + def trigger( self, vault_name: str, resource_group_name: str, @@ -136,7 +138,7 @@ def trigger( # pylint: disable=inconsistent-return-statements """ @overload - def trigger( # pylint: disable=inconsistent-return-statements + def trigger( self, vault_name: str, resource_group_name: str, @@ -207,7 +209,7 @@ def trigger( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -244,7 +246,6 @@ def trigger( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_bms_prepare_data_move_operation_result_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_bms_prepare_data_move_operation_result_operations.py index 4810cef7e426..fd968ed0af15 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_bms_prepare_data_move_operation_result_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_bms_prepare_data_move_operation_result_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -17,16 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -104,7 +106,7 @@ def get( or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -127,7 +129,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -144,7 +145,9 @@ def get( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VaultStorageConfigOperationResultResponse", pipeline_response) + deserialized = self._deserialize( + "VaultStorageConfigOperationResultResponse", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_deleted_protection_containers_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_deleted_protection_containers_operations.py index 90ec88821a6a..3862bd8c944e 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_deleted_protection_containers_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_deleted_protection_containers_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -19,16 +19,18 @@ ) 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.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -113,7 +115,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ProtectionContainerResourceList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -133,7 +135,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -149,7 +150,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_export_jobs_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_export_jobs_operation_results_operations.py index 8cb9ad9809d3..fb04fdaa86e8 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_export_jobs_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_export_jobs_operation_results_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -17,16 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -105,7 +107,7 @@ def get( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.OperationResultInfoBaseResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -128,7 +130,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -142,11 +143,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("OperationResultInfoBaseResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("OperationResultInfoBaseResource", pipeline_response) + deserialized = self._deserialize("OperationResultInfoBaseResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_feature_support_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_feature_support_operations.py index df213878578f..94e872263d70 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_feature_support_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_feature_support_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -18,16 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -151,7 +153,7 @@ def validate( ~azure.mgmt.recoveryservicesbackup.activestamp.models.AzureVMResourceFeatureSupportResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -184,7 +186,6 @@ def validate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -198,7 +199,7 @@ def validate( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureVMResourceFeatureSupportResponse", pipeline_response) + deserialized = self._deserialize("AzureVMResourceFeatureSupportResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_fetch_tiering_cost_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_fetch_tiering_cost_operations.py index c9cb1c5cf751..3dace663cc23 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_fetch_tiering_cost_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_fetch_tiering_cost_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterator, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,12 +15,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -28,8 +29,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -96,8 +100,8 @@ def _post_initial( vault_name: str, parameters: Union[_models.FetchTieringCostInfoRequest, IO[bytes]], **kwargs: Any - ) -> Optional[_models.TieringCostInfo]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -110,7 +114,7 @@ def _post_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.TieringCostInfo]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -131,10 +135,10 @@ def _post_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -142,17 +146,19 @@ def _post_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("TieringCostInfo", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -269,10 +275,11 @@ def begin_post( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("TieringCostInfo", pipeline_response) + deserialized = self._deserialize("TieringCostInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_get_tiering_cost_operation_result_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_get_tiering_cost_operation_result_operations.py index 07762149a561..5cc9842602da 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_get_tiering_cost_operation_result_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_get_tiering_cost_operation_result_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -17,16 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -104,7 +106,7 @@ def get( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.TieringCostInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -127,7 +129,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -141,7 +142,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TieringCostInfo", pipeline_response) + deserialized = self._deserialize("TieringCostInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_item_level_recovery_connections_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_item_level_recovery_connections_operations.py index 85afb8cdb6eb..a9d96344c155 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_item_level_recovery_connections_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_item_level_recovery_connections_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -18,16 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -142,7 +144,7 @@ def __init__(self, *args, **kwargs): self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @overload - def provision( # pylint: disable=inconsistent-return-statements + def provision( self, vault_name: str, resource_group_name: str, @@ -188,7 +190,7 @@ def provision( # pylint: disable=inconsistent-return-statements """ @overload - def provision( # pylint: disable=inconsistent-return-statements + def provision( self, vault_name: str, resource_group_name: str, @@ -275,7 +277,7 @@ def provision( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -313,7 +315,6 @@ def provision( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -365,7 +366,7 @@ def revoke( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -391,7 +392,6 @@ def revoke( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_job_cancellations_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_job_cancellations_operations.py index ab0a45d18b10..0bff305f5d13 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_job_cancellations_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_job_cancellations_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -17,16 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -103,7 +105,7 @@ def trigger( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -126,7 +128,6 @@ def trigger( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_job_details_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_job_details_operations.py index 0f929846240a..013b11efcbea 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_job_details_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_job_details_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -17,16 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -100,7 +102,7 @@ def get(self, vault_name: str, resource_group_name: str, job_name: str, **kwargs :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.JobResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -123,7 +125,6 @@ def get(self, vault_name: str, resource_group_name: str, job_name: str, **kwargs headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -137,7 +138,7 @@ def get(self, vault_name: str, resource_group_name: str, job_name: str, **kwargs map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("JobResource", pipeline_response) + deserialized = self._deserialize("JobResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_job_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_job_operation_results_operations.py index f1c2f35a0569..365506d138c5 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_job_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_job_operation_results_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -17,16 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -106,7 +108,7 @@ def get( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -130,7 +132,6 @@ def get( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_jobs_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_jobs_operations.py index ffa3b532e8e6..ef8876d7c908 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_jobs_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_jobs_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -17,16 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -103,7 +105,7 @@ def export( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -126,7 +128,6 @@ def export( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_operation_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_operation_operations.py index 927bfaa04ebf..3c624e4df5ed 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_operation_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_operation_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -18,16 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -167,7 +169,7 @@ def validate( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ValidateOperationsResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -201,7 +203,6 @@ def validate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -215,7 +216,7 @@ def validate( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ValidateOperationsResponse", pipeline_response) + deserialized = self._deserialize("ValidateOperationsResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_operations.py index 2f3b18ea399c..5fb3cbc040e0 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -19,16 +19,18 @@ ) 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.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -76,6 +78,7 @@ def __init__(self, *args, **kwargs): @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.ClientDiscoveryValueForSingleApi"]: + # pylint: disable=line-too-long """Returns the list of available operations. :return: An iterator like instance of either ClientDiscoveryValueForSingleApi or the result of @@ -90,7 +93,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.ClientDiscoveryValueForSingle api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ClientDiscoveryResponse] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -106,7 +109,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -122,7 +124,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_private_endpoint_connection_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_private_endpoint_connection_operations.py index daa9309a0568..2485869d9e71 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_private_endpoint_connection_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_private_endpoint_connection_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterator, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,12 +15,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -28,8 +29,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -190,7 +194,7 @@ def get( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.PrivateEndpointConnectionResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -213,7 +217,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -228,7 +231,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -242,8 +245,8 @@ def _put_initial( private_endpoint_connection_name: str, parameters: Union[_models.PrivateEndpointConnectionResource, IO[bytes]], **kwargs: Any - ) -> _models.PrivateEndpointConnectionResource: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -256,7 +259,7 @@ def _put_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PrivateEndpointConnectionResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -278,10 +281,10 @@ def _put_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -289,14 +292,14 @@ def _put_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -314,6 +317,7 @@ def begin_put( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.PrivateEndpointConnectionResource]: + # pylint: disable=line-too-long """Approve or Reject Private Endpoint requests. This call is made by Backup Admin. :param vault_name: The name of the recovery services vault. Required. @@ -347,6 +351,7 @@ def begin_put( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.PrivateEndpointConnectionResource]: + # pylint: disable=line-too-long """Approve or Reject Private Endpoint requests. This call is made by Backup Admin. :param vault_name: The name of the recovery services vault. Required. @@ -377,6 +382,7 @@ def begin_put( parameters: Union[_models.PrivateEndpointConnectionResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.PrivateEndpointConnectionResource]: + # pylint: disable=line-too-long """Approve or Reject Private Endpoint requests. This call is made by Backup Admin. :param vault_name: The name of the recovery services vault. Required. @@ -419,10 +425,11 @@ def begin_put( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -444,10 +451,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, vault_name: str, resource_group_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -459,7 +466,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( vault_name=vault_name, @@ -470,10 +477,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -481,11 +488,19 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -513,7 +528,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( vault_name=vault_name, resource_group_name=resource_group_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -523,6 +538,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_private_endpoint_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_private_endpoint_operations.py index 6a8a7f8566e3..17767a74c68c 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_private_endpoint_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_private_endpoint_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -17,16 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -119,7 +121,7 @@ def get_operation_status( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.OperationStatus :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -143,7 +145,6 @@ def get_operation_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -158,7 +159,7 @@ def get_operation_status( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("OperationStatus", pipeline_response) + deserialized = self._deserialize("OperationStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protectable_containers_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protectable_containers_operations.py index 93a6e870e2de..3037f3b5123e 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protectable_containers_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protectable_containers_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -19,16 +19,18 @@ ) 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.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -99,6 +101,7 @@ def __init__(self, *args, **kwargs): def list( self, vault_name: str, resource_group_name: str, fabric_name: str, filter: Optional[str] = None, **kwargs: Any ) -> Iterable["_models.ProtectableContainerResource"]: + # pylint: disable=line-too-long """Lists the containers that can be registered to Recovery Services Vault. :param vault_name: The name of the recovery services vault. Required. @@ -122,7 +125,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ProtectableContainerResourceList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -143,7 +146,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -159,7 +161,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protected_item_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protected_item_operation_results_operations.py index 517d26429386..9fa713e1acc1 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protected_item_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protected_item_operation_results_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -17,16 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -126,7 +128,7 @@ def get( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectedItemResource or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -152,7 +154,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -168,7 +169,7 @@ def get( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProtectedItemResource", pipeline_response) + deserialized = self._deserialize("ProtectedItemResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protected_item_operation_statuses_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protected_item_operation_statuses_operations.py index 9e622bbd83e8..feed4aaef424 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protected_item_operation_statuses_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protected_item_operation_statuses_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -17,16 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -130,7 +132,7 @@ def get( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.OperationStatus :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -156,7 +158,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -170,7 +171,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("OperationStatus", pipeline_response) + deserialized = self._deserialize("OperationStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protected_items_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protected_items_operations.py index 9fef0bf4c059..0c0f224c40f6 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protected_items_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protected_items_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -18,16 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -219,7 +221,7 @@ def get( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectedItemResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -245,7 +247,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -259,7 +260,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProtectedItemResource", pipeline_response) + deserialized = self._deserialize("ProtectedItemResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -388,7 +389,7 @@ def create_or_update( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectedItemResource or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -426,7 +427,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -442,7 +442,7 @@ def create_or_update( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProtectedItemResource", pipeline_response) + deserialized = self._deserialize("ProtectedItemResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -478,7 +478,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -503,7 +503,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_container_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_container_operation_results_operations.py index 4cfad234d35b..33ab56546575 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_container_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_container_operation_results_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -17,16 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -122,7 +124,7 @@ def get( None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -147,7 +149,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -163,7 +164,7 @@ def get( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProtectionContainerResource", pipeline_response) + deserialized = self._deserialize("ProtectionContainerResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_container_refresh_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_container_refresh_operation_results_operations.py index 535ad26414a1..8b52e5ff486a 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_container_refresh_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_container_refresh_operation_results_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -17,16 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -106,7 +108,7 @@ def get( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -130,7 +132,6 @@ def get( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_containers_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_containers_operations.py index 889258ba88db..4fc318fef8f2 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_containers_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_containers_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterator, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,12 +15,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -28,8 +29,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -274,7 +278,7 @@ def get( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionContainerResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -298,7 +302,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -312,7 +315,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProtectionContainerResource", pipeline_response) + deserialized = self._deserialize("ProtectionContainerResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -327,8 +330,8 @@ def _register_initial( container_name: str, parameters: Union[_models.ProtectionContainerResource, IO[bytes]], **kwargs: Any - ) -> Optional[_models.ProtectionContainerResource]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -341,7 +344,7 @@ def _register_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.ProtectionContainerResource]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -364,10 +367,10 @@ def _register_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -375,12 +378,14 @@ def _register_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("ProtectionContainerResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -399,6 +404,7 @@ def begin_register( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ProtectionContainerResource]: + # pylint: disable=line-too-long """Registers the container with Recovery Services vault. This is an asynchronous operation. To track the operation status, use location header to call get latest status of @@ -438,6 +444,7 @@ def begin_register( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ProtectionContainerResource]: + # pylint: disable=line-too-long """Registers the container with Recovery Services vault. This is an asynchronous operation. To track the operation status, use location header to call get latest status of @@ -474,6 +481,7 @@ def begin_register( parameters: Union[_models.ProtectionContainerResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.ProtectionContainerResource]: + # pylint: disable=line-too-long """Registers the container with Recovery Services vault. This is an asynchronous operation. To track the operation status, use location header to call get latest status of @@ -521,10 +529,11 @@ def begin_register( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ProtectionContainerResource", pipeline_response) + deserialized = self._deserialize("ProtectionContainerResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -569,7 +578,7 @@ def unregister( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -593,7 +602,6 @@ def unregister( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -640,7 +648,7 @@ def inquire( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -665,7 +673,6 @@ def inquire( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -704,7 +711,7 @@ def refresh( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -728,7 +735,6 @@ def refresh( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_intent_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_intent_operations.py index 206f0a98fff3..e80b711e5eb5 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_intent_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_intent_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -18,16 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -291,7 +293,7 @@ def validate( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.PreValidateEnableBackupResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -324,7 +326,6 @@ def validate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -338,7 +339,7 @@ def validate( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PreValidateEnableBackupResponse", pipeline_response) + deserialized = self._deserialize("PreValidateEnableBackupResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -366,7 +367,7 @@ def get( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionIntentResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -390,7 +391,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -404,7 +404,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProtectionIntentResource", pipeline_response) + deserialized = self._deserialize("ProtectionIntentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -507,7 +507,7 @@ def create_or_update( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionIntentResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -543,7 +543,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -557,7 +556,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProtectionIntentResource", pipeline_response) + deserialized = self._deserialize("ProtectionIntentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -583,7 +582,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -607,7 +606,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_policies_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_policies_operations.py index 040b1df45c96..b4152ff59c78 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_policies_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterator, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,12 +15,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -28,8 +29,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -184,7 +188,7 @@ def get( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionPolicyResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -207,7 +211,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -221,7 +224,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProtectionPolicyResource", pipeline_response) + deserialized = self._deserialize("ProtectionPolicyResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -330,7 +333,7 @@ def create_or_update( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionPolicyResource or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -366,7 +369,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -382,17 +384,17 @@ def create_or_update( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProtectionPolicyResource", pipeline_response) + deserialized = self._deserialize("ProtectionPolicyResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, vault_name: str, resource_group_name: str, policy_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -404,7 +406,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( vault_name=vault_name, @@ -415,10 +417,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -426,11 +428,19 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -460,7 +470,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( vault_name=vault_name, resource_group_name=resource_group_name, policy_name=policy_name, @@ -470,6 +480,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_policy_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_policy_operation_results_operations.py index 749e560d652d..6afd63d09d2d 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_policy_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_policy_operation_results_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -17,16 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -106,7 +108,7 @@ def get( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionPolicyResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -130,7 +132,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -144,7 +145,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProtectionPolicyResource", pipeline_response) + deserialized = self._deserialize("ProtectionPolicyResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_policy_operation_statuses_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_policy_operation_statuses_operations.py index 24f85cc9799f..9ede0eab7acb 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_policy_operation_statuses_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_policy_operation_statuses_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -17,16 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -110,7 +112,7 @@ def get( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.OperationStatus :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -134,7 +136,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -148,7 +149,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("OperationStatus", pipeline_response) + deserialized = self._deserialize("OperationStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_recovery_points_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_recovery_points_operations.py index 4dc98569c676..16c461d56d45 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_recovery_points_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_recovery_points_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -19,16 +19,18 @@ ) 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.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -179,7 +181,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RecoveryPointResourceList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -202,7 +204,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -218,7 +219,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -281,7 +281,7 @@ def get( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryPointResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -307,7 +307,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -321,7 +320,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecoveryPointResource", pipeline_response) + deserialized = self._deserialize("RecoveryPointResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_recovery_points_recommended_for_move_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_recovery_points_recommended_for_move_operations.py index f3687b3e6ed2..9fbb26394ebe 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_recovery_points_recommended_for_move_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_recovery_points_recommended_for_move_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -20,16 +20,18 @@ ) 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.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -218,7 +220,7 @@ def list( content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RecoveryPointResourceList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -250,7 +252,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -266,7 +267,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_recovery_services_backup_client_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_recovery_services_backup_client_operations.py index 25f497783d64..a60736f5d6e4 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_recovery_services_backup_client_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_recovery_services_backup_client_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterator, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,12 +15,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -28,8 +29,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request +from .._vendor import RecoveryServicesBackupClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -185,6 +190,7 @@ def build_move_recovery_point_request( class RecoveryServicesBackupClientOperationsMixin( # pylint: disable=name-too-long RecoveryServicesBackupClientMixinABC ): + @distributed_trace def get_operation_status( self, vault_name: str, resource_group_name: str, operation_id: str, **kwargs: Any @@ -202,7 +208,7 @@ def get_operation_status( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.OperationStatus :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -225,7 +231,6 @@ def get_operation_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -240,21 +245,21 @@ def get_operation_status( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("OperationStatus", pipeline_response) + deserialized = self._deserialize("OperationStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _bms_prepare_data_move_initial( # pylint: disable=inconsistent-return-statements + def _bms_prepare_data_move_initial( self, vault_name: str, resource_group_name: str, parameters: Union[_models.PrepareDataMoveRequest, IO[bytes]], **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -267,7 +272,7 @@ def _bms_prepare_data_move_initial( # pylint: disable=inconsistent-return-state api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -288,10 +293,10 @@ def _bms_prepare_data_move_initial( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -299,12 +304,20 @@ def _bms_prepare_data_move_initial( # pylint: disable=inconsistent-return-state response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_bms_prepare_data_move( @@ -393,7 +406,7 @@ def begin_bms_prepare_data_move( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._bms_prepare_data_move_initial( # type: ignore + raw_result = self._bms_prepare_data_move_initial( vault_name=vault_name, resource_group_name=resource_group_name, parameters=parameters, @@ -404,6 +417,7 @@ def begin_bms_prepare_data_move( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -425,14 +439,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _bms_trigger_data_move_initial( # pylint: disable=inconsistent-return-statements + def _bms_trigger_data_move_initial( self, vault_name: str, resource_group_name: str, parameters: Union[_models.TriggerDataMoveRequest, IO[bytes]], **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -445,7 +459,7 @@ def _bms_trigger_data_move_initial( # pylint: disable=inconsistent-return-state api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -466,10 +480,10 @@ def _bms_trigger_data_move_initial( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -477,12 +491,20 @@ def _bms_trigger_data_move_initial( # pylint: disable=inconsistent-return-state response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_bms_trigger_data_move( @@ -571,7 +593,7 @@ def begin_bms_trigger_data_move( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._bms_trigger_data_move_initial( # type: ignore + raw_result = self._bms_trigger_data_move_initial( vault_name=vault_name, resource_group_name=resource_group_name, parameters=parameters, @@ -582,6 +604,7 @@ def begin_bms_trigger_data_move( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -603,7 +626,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _move_recovery_point_initial( # pylint: disable=inconsistent-return-statements + def _move_recovery_point_initial( self, vault_name: str, resource_group_name: str, @@ -613,8 +636,8 @@ def _move_recovery_point_initial( # pylint: disable=inconsistent-return-stateme recovery_point_id: str, parameters: Union[_models.MoveRPAcrossTiersRequest, IO[bytes]], **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -627,7 +650,7 @@ def _move_recovery_point_initial( # pylint: disable=inconsistent-return-stateme api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -652,10 +675,10 @@ def _move_recovery_point_initial( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -663,11 +686,19 @@ def _move_recovery_point_initial( # pylint: disable=inconsistent-return-stateme response = pipeline_response.http_response if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_move_recovery_point( @@ -799,7 +830,7 @@ def begin_move_recovery_point( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._move_recovery_point_initial( # type: ignore + raw_result = self._move_recovery_point_initial( vault_name=vault_name, resource_group_name=resource_group_name, fabric_name=fabric_name, @@ -814,6 +845,7 @@ def begin_move_recovery_point( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_resource_guard_proxies_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_resource_guard_proxies_operations.py index 566aee59c897..35cd208bfb6d 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_resource_guard_proxies_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_resource_guard_proxies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -19,16 +19,18 @@ ) 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.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -88,6 +90,7 @@ def __init__(self, *args, **kwargs): def get( self, vault_name: str, resource_group_name: str, **kwargs: Any ) -> Iterable["_models.ResourceGuardProxyBaseResource"]: + # pylint: disable=line-too-long """List the ResourceGuardProxies under vault. :param vault_name: The name of the recovery services vault. Required. @@ -107,7 +110,7 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ResourceGuardProxyBaseResourceList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -126,7 +129,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -142,7 +144,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_resource_guard_proxy_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_resource_guard_proxy_operations.py index 094ea7c810d5..88cf9f6bfcf9 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_resource_guard_proxy_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_resource_guard_proxy_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -18,16 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -205,7 +207,7 @@ def get( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ResourceGuardProxyBaseResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -228,7 +230,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -242,7 +243,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceGuardProxyBaseResource", pipeline_response) + deserialized = self._deserialize("ResourceGuardProxyBaseResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -340,7 +341,7 @@ def put( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ResourceGuardProxyBaseResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -375,7 +376,6 @@ def put( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -389,7 +389,7 @@ def put( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceGuardProxyBaseResource", pipeline_response) + deserialized = self._deserialize("ResourceGuardProxyBaseResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -413,7 +413,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -436,7 +436,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -539,7 +538,7 @@ def unlock_delete( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.UnlockDeleteResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -574,7 +573,6 @@ def unlock_delete( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -588,7 +586,7 @@ def unlock_delete( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("UnlockDeleteResponse", pipeline_response) + deserialized = self._deserialize("UnlockDeleteResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_restores_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_restores_operations.py index d6dd9a3916fe..16e4e7628977 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_restores_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_restores_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterator, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,12 +15,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -28,8 +29,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -107,7 +111,7 @@ def __init__(self, *args, **kwargs): 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") - def _trigger_initial( # pylint: disable=inconsistent-return-statements + def _trigger_initial( self, vault_name: str, resource_group_name: str, @@ -118,8 +122,8 @@ def _trigger_initial( # pylint: disable=inconsistent-return-statements parameters: Union[_models.RestoreRequestResource, IO[bytes]], x_ms_authorization_auxiliary: Optional[str] = None, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -132,7 +136,7 @@ def _trigger_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -158,10 +162,10 @@ def _trigger_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -169,11 +173,19 @@ def _trigger_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_trigger( @@ -316,7 +328,7 @@ def begin_trigger( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._trigger_initial( # type: ignore + raw_result = self._trigger_initial( vault_name=vault_name, resource_group_name=resource_group_name, fabric_name=fabric_name, @@ -332,6 +344,7 @@ def begin_trigger( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_security_pins_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_security_pins_operations.py index 8f7d14949201..aa660c257ddc 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_security_pins_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_security_pins_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -18,16 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -183,7 +185,7 @@ def get( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.TokenInformation :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -221,7 +223,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -235,7 +236,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TokenInformation", pipeline_response) + deserialized = self._deserialize("TokenInformation", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_tiering_cost_operation_status_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_tiering_cost_operation_status_operations.py index 85abf747013e..d7027d501a8e 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_tiering_cost_operation_status_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_tiering_cost_operation_status_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -17,16 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -104,7 +106,7 @@ def get( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.OperationStatus :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -127,7 +129,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -141,7 +142,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("OperationStatus", pipeline_response) + deserialized = self._deserialize("OperationStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_validate_operation_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_validate_operation_operations.py index 8a51dde3ce9b..477ceaae5094 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_validate_operation_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_validate_operation_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterator, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,12 +15,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -28,8 +29,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -90,14 +94,14 @@ def __init__(self, *args, **kwargs): 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") - def _trigger_initial( # pylint: disable=inconsistent-return-statements + def _trigger_initial( self, vault_name: str, resource_group_name: str, parameters: Union[_models.ValidateOperationRequestResource, IO[bytes]], **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -110,7 +114,7 @@ def _trigger_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -131,10 +135,10 @@ def _trigger_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -142,11 +146,19 @@ def _trigger_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_trigger( @@ -240,7 +252,7 @@ def begin_trigger( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._trigger_initial( # type: ignore + raw_result = self._trigger_initial( vault_name=vault_name, resource_group_name=resource_group_name, parameters=parameters, @@ -251,6 +263,7 @@ def begin_trigger( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_validate_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_validate_operation_results_operations.py index 54ca992353c3..70d8fffcb362 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_validate_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_validate_operation_results_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -17,16 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -104,7 +106,7 @@ def get( None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -127,7 +129,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -143,7 +144,7 @@ def get( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ValidateOperationsResponse", pipeline_response) + deserialized = self._deserialize("ValidateOperationsResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_validate_operation_statuses_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_validate_operation_statuses_operations.py index bf89337ce172..68085be8322f 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_validate_operation_statuses_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_validate_operation_statuses_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -17,16 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -107,7 +109,7 @@ def get( :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.OperationStatus :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -130,7 +132,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -144,7 +145,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("OperationStatus", pipeline_response) + deserialized = self._deserialize("OperationStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/__init__.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/__init__.py index afc47936376d..a067ea121371 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/__init__.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/__init__.py @@ -5,15 +5,21 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._recovery_services_backup_passive_client import RecoveryServicesBackupPassiveClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._recovery_services_backup_passive_client import RecoveryServicesBackupPassiveClient # type: ignore from ._version import VERSION __version__ = VERSION try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -21,6 +27,6 @@ __all__ = [ "RecoveryServicesBackupPassiveClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_configuration.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_configuration.py index 92abb37b5d09..0f88a14190a5 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_configuration.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_configuration.py @@ -14,7 +14,6 @@ from ._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_recovery_services_backup_passive_client.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_recovery_services_backup_passive_client.py index 92c227931469..047afd817175 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_recovery_services_backup_passive_client.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_recovery_services_backup_passive_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -32,11 +33,10 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class RecoveryServicesBackupPassiveClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class RecoveryServicesBackupPassiveClient: # pylint: disable=too-many-instance-attributes """Open API 2.0 Specs for Azure RecoveryServices Backup service. :ivar backup_usage_summaries_crr: BackupUsageSummariesCRROperations operations @@ -172,7 +172,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "RecoveryServicesBackupPassiveClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_serialization.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_serialization.py index 2f781d740827..b24ab2885450 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_serialization.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_serialization.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # # Copyright (c) Microsoft Corporation. All rights reserved. @@ -24,7 +25,6 @@ # # -------------------------------------------------------------------------- -# pylint: skip-file # pyright: reportUnnecessaryTypeIgnoreComment=false from base64 import b64decode, b64encode @@ -52,7 +52,6 @@ MutableMapping, Type, List, - Mapping, ) try: @@ -91,6 +90,8 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: :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. + :return: The deserialized data. + :rtype: object """ if hasattr(data, "read"): # Assume a stream @@ -112,7 +113,7 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: try: return json.loads(data_as_str) except ValueError as err: - raise DeserializationError("JSON is invalid: {}".format(err), err) + raise DeserializationError("JSON is invalid: {}".format(err), err) from err elif "xml" in (content_type or []): try: @@ -144,6 +145,8 @@ def _json_attemp(data): # context otherwise. _LOGGER.critical("Wasn't XML not JSON, failing") raise DeserializationError("XML is invalid") from err + elif content_type.startswith("text/"): + return data_as_str raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod @@ -153,6 +156,11 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], Use bytes and headers to NOT use any requests/aiohttp or whatever specific implementation. Headers will tested for "content-type" + + :param bytes body_bytes: The body of the response. + :param dict headers: The headers of the response. + :returns: The deserialized data. + :rtype: object """ # Try to use content-type from headers if available content_type = None @@ -182,15 +190,30 @@ class UTC(datetime.tzinfo): """Time Zone info for handling UTC""" def utcoffset(self, dt): - """UTF offset for UTC is 0.""" + """UTF offset for UTC is 0. + + :param datetime.datetime dt: The datetime + :returns: The offset + :rtype: datetime.timedelta + """ return datetime.timedelta(0) def tzname(self, dt): - """Timestamp representation.""" + """Timestamp representation. + + :param datetime.datetime dt: The datetime + :returns: The timestamp representation + :rtype: str + """ return "Z" def dst(self, dt): - """No daylight saving for UTC.""" + """No daylight saving for UTC. + + :param datetime.datetime dt: The datetime + :returns: The daylight saving time + :rtype: datetime.timedelta + """ return datetime.timedelta(hours=1) @@ -204,7 +227,7 @@ class _FixedOffset(datetime.tzinfo): # type: ignore :param datetime.timedelta offset: offset in timedelta format """ - def __init__(self, offset): + def __init__(self, offset) -> None: self.__offset = offset def utcoffset(self, dt): @@ -233,24 +256,26 @@ def __getinitargs__(self): _FLATTEN = re.compile(r"(? None: self.additional_properties: Optional[Dict[str, Any]] = {} - for k in kwargs: + for k in kwargs: # pylint: disable=consider-using-dict-items if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) elif k in self._validation and self._validation[k].get("readonly", False): @@ -298,13 +330,23 @@ def __init__(self, **kwargs: Any) -> None: setattr(self, k, kwargs[k]) def __eq__(self, other: Any) -> bool: - """Compare objects by comparing all attributes.""" + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are equal + :rtype: bool + """ if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False def __ne__(self, other: Any) -> bool: - """Compare objects by comparing all attributes.""" + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are not equal + :rtype: bool + """ return not self.__eq__(other) def __str__(self) -> str: @@ -324,7 +366,11 @@ def is_xml_model(cls) -> bool: @classmethod def _create_xml_node(cls): - """Create XML node.""" + """Create XML node. + + :returns: The XML node + :rtype: xml.etree.ElementTree.Element + """ try: xml_map = cls._xml_map # type: ignore except AttributeError: @@ -344,7 +390,9 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) # type: ignore + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, keep_readonly=keep_readonly, **kwargs + ) def as_dict( self, @@ -378,12 +426,15 @@ def my_key_transformer(key, attr_desc, value): If you want XML serialization, you can pass the kwargs is_xml=True. + :param bool keep_readonly: If you want to serialize the readonly attributes :param function key_transformer: A key transformer function. :returns: A dict JSON compatible object :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) # type: ignore + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs + ) @classmethod def _infer_class_models(cls): @@ -393,7 +444,7 @@ def _infer_class_models(cls): client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} if cls.__name__ not in client_models: raise ValueError("Not Autorest generated code") - except Exception: + except Exception: # pylint: disable=broad-exception-caught # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. client_models = {cls.__name__: cls} return client_models @@ -406,6 +457,7 @@ def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = N :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model :raises: DeserializationError if something went wrong + :rtype: ModelType """ deserializer = Deserializer(cls._infer_class_models()) return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @@ -424,9 +476,11 @@ def from_dict( and last_rest_key_case_insensitive_extractor) :param dict data: A dict using RestAPI structure + :param function key_extractors: A key extractor function. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model :raises: DeserializationError if something went wrong + :rtype: ModelType """ deserializer = Deserializer(cls._infer_class_models()) deserializer.key_extractors = ( # type: ignore @@ -446,21 +500,25 @@ def _flatten_subtype(cls, key, objects): return {} result = dict(cls._subtype_map[key]) for valuetype in cls._subtype_map[key].values(): - result.update(objects[valuetype]._flatten_subtype(key, objects)) + result.update(objects[valuetype]._flatten_subtype(key, objects)) # pylint: disable=protected-access return result @classmethod def _classify(cls, response, objects): """Check the class _subtype_map for any child classes. We want to ignore any inherited _subtype_maps. - Remove the polymorphic key from the initial data. + + :param dict response: The initial data + :param dict objects: The class objects + :returns: The class to be used + :rtype: class """ for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): subtype_value = None if not isinstance(response, ET.Element): rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] - subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None) + subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None) else: subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) if subtype_value: @@ -499,11 +557,13 @@ def _decode_attribute_map_key(key): inside the received data. :param str key: A key string from the generated code + :returns: The decoded key + :rtype: str """ return key.replace("\\.", ".") -class Serializer(object): +class Serializer: # pylint: disable=too-many-public-methods """Request object model serializer.""" basic_types = {str: "str", int: "int", bool: "bool", float: "float"} @@ -538,7 +598,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes: Optional[Mapping[str, type]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -558,13 +618,16 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None): self.key_transformer = full_restapi_key_transformer self.client_side_validation = True - def _serialize(self, target_obj, data_type=None, **kwargs): + def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals + self, target_obj, data_type=None, **kwargs + ): """Serialize data into a string according to type. - :param target_obj: The data to be serialized. + :param object 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. + :returns: The serialized data. """ key_transformer = kwargs.get("key_transformer", self.key_transformer) keep_readonly = kwargs.get("keep_readonly", False) @@ -590,12 +653,14 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized = {} if is_xml_model_serialization: - serialized = target_obj._create_xml_node() + serialized = target_obj._create_xml_node() # pylint: disable=protected-access try: - attributes = target_obj._attribute_map + attributes = target_obj._attribute_map # pylint: disable=protected-access for attr, attr_desc in attributes.items(): attr_name = attr - if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False): + if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access + attr_name, {} + ).get("readonly", False): continue if attr_name == "additional_properties" and attr_desc["key"] == "": @@ -631,7 +696,8 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if isinstance(new_attr, list): serialized.extend(new_attr) # type: ignore 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 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 @@ -662,17 +728,17 @@ def _serialize(self, target_obj, data_type=None, **kwargs): except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) raise SerializationError(msg) from err - else: - return serialized + return serialized def body(self, data, data_type, **kwargs): """Serialize data intended for a request body. - :param data: The data to be serialized. + :param object 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 + :returns: The serialized request body """ # Just in case this is a dict @@ -701,7 +767,7 @@ def body(self, data, data_type, **kwargs): attribute_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, ] - data = deserializer._deserialize(data_type, data) + data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access except DeserializationError as err: raise SerializationError("Unable to build a model: " + str(err)) from err @@ -710,9 +776,11 @@ def body(self, 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 name: The name of the URL path parameter. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str + :returns: The serialized URL path :raises: TypeError if serialization fails. :raises: ValueError if data is None """ @@ -726,21 +794,20 @@ def url(self, name, data, data_type, **kwargs): output = output.replace("{", quote("{")).replace("}", quote("}")) else: output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return output + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + 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 name: The name of the query parameter. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :keyword bool skip_quote: Whether to skip quote the serialized result. - Defaults to False. :rtype: str, list :raises: TypeError if serialization fails. :raises: ValueError if data is None + :returns: The serialized query parameter """ try: # Treat the list aside, since we don't want to encode the div separator @@ -757,19 +824,20 @@ def query(self, name, data, data_type, **kwargs): output = str(output) else: output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return str(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + 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 name: The name of the header. + :param object 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 + :returns: The serialized header """ try: if data_type in ["[str]"]: @@ -778,21 +846,20 @@ def header(self, name, data, data_type, **kwargs): 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) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + 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 object 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. + :returns: The serialized data. + :rtype: str, int, float, bool, dict, list """ if data is None: raise ValueError("No value for given attribute") @@ -803,7 +870,7 @@ def serialize_data(self, data, data_type, **kwargs): if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) - elif data_type in self.serialize_type: + if data_type in self.serialize_type: return self.serialize_type[data_type](data, **kwargs) # If dependencies is empty, try with current data class @@ -819,11 +886,10 @@ def serialize_data(self, data, data_type, **kwargs): except (ValueError, TypeError) as err: msg = "Unable to serialize value: {!r} as type: {!r}." raise SerializationError(msg.format(data, data_type)) from err - else: - return self._serialize(data, **kwargs) + return self._serialize(data, **kwargs) @classmethod - def _get_custom_serializers(cls, data_type, **kwargs): + def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) if custom_serializer: return custom_serializer @@ -839,23 +905,26 @@ def serialize_basic(cls, data, data_type, **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 obj data: Object to be serialized. :param str data_type: Type of object in the iterable. + :rtype: str, int, float, bool + :return: serialized object """ 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 + return eval(data_type)(data) # nosec # pylint: disable=eval-used @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. + :param str data: Object to be serialized. :rtype: str + :return: serialized object """ try: # If I received an enum, return its value return data.value @@ -869,8 +938,7 @@ def serialize_unicode(cls, data): return data except NameError: return str(data) - else: - return str(data) + return str(data) def serialize_iter(self, data, iter_type, div=None, **kwargs): """Serialize iterable. @@ -880,15 +948,13 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): 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 list data: 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'. - :keyword bool do_quote: Whether to quote the serialized result of each iterable element. Defaults to False. :rtype: list, str + :return: serialized iterable """ if isinstance(data, str): raise SerializationError("Refuse str type as a valid iter type.") @@ -943,9 +1009,8 @@ def serialize_dict(self, attr, dict_type, **kwargs): :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 + :return: serialized dictionary """ serialization_ctxt = kwargs.get("serialization_ctxt", {}) serialized = {} @@ -969,7 +1034,7 @@ def serialize_dict(self, attr, dict_type, **kwargs): return serialized - def serialize_object(self, attr, **kwargs): + def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements """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 @@ -977,6 +1042,7 @@ def serialize_object(self, attr, **kwargs): :param dict attr: Object to be serialized. :rtype: dict or str + :return: serialized object """ if attr is None: return None @@ -1001,7 +1067,7 @@ def serialize_object(self, attr, **kwargs): 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): + if obj_type in self.dependencies.values() or isinstance(attr, Model): return self._serialize(attr) if obj_type == dict: @@ -1032,56 +1098,61 @@ def serialize_enum(attr, enum_obj=None): try: enum_obj(result) # type: ignore return result - except ValueError: + except ValueError as exc: for enum_value in enum_obj: # type: ignore 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)) + raise SerializationError(error.format(attr, enum_obj)) from exc @staticmethod - def serialize_bytearray(attr, **kwargs): + def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument """Serialize bytearray into base-64 string. - :param attr: Object to be serialized. + :param str attr: Object to be serialized. :rtype: str + :return: serialized base64 """ return b64encode(attr).decode() @staticmethod - def serialize_base64(attr, **kwargs): + def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument """Serialize str into base-64 string. - :param attr: Object to be serialized. + :param str attr: Object to be serialized. :rtype: str + :return: serialized base64 """ encoded = b64encode(attr).decode("ascii") return encoded.strip("=").replace("+", "-").replace("/", "_") @staticmethod - def serialize_decimal(attr, **kwargs): + def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument """Serialize Decimal object to float. - :param attr: Object to be serialized. + :param decimal attr: Object to be serialized. :rtype: float + :return: serialized decimal """ return float(attr) @staticmethod - def serialize_long(attr, **kwargs): + def serialize_long(attr, **kwargs): # pylint: disable=unused-argument """Serialize long (Py2) or int (Py3). - :param attr: Object to be serialized. + :param int attr: Object to be serialized. :rtype: int/long + :return: serialized long """ return _long_type(attr) @staticmethod - def serialize_date(attr, **kwargs): + def serialize_date(attr, **kwargs): # pylint: disable=unused-argument """Serialize Date object into ISO-8601 formatted string. :param Date attr: Object to be serialized. :rtype: str + :return: serialized date """ if isinstance(attr, str): attr = isodate.parse_date(attr) @@ -1089,11 +1160,12 @@ def serialize_date(attr, **kwargs): return t @staticmethod - def serialize_time(attr, **kwargs): + def serialize_time(attr, **kwargs): # pylint: disable=unused-argument """Serialize Time object into ISO-8601 formatted string. :param datetime.time attr: Object to be serialized. :rtype: str + :return: serialized time """ if isinstance(attr, str): attr = isodate.parse_time(attr) @@ -1103,30 +1175,32 @@ def serialize_time(attr, **kwargs): return t @staticmethod - def serialize_duration(attr, **kwargs): + def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument """Serialize TimeDelta object into ISO-8601 formatted string. :param TimeDelta attr: Object to be serialized. :rtype: str + :return: serialized duration """ if isinstance(attr, str): attr = isodate.parse_duration(attr) return isodate.duration_isoformat(attr) @staticmethod - def serialize_rfc(attr, **kwargs): + def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into RFC-1123 formatted string. :param Datetime attr: Object to be serialized. :rtype: str :raises: TypeError if format invalid. + :return: serialized rfc """ 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.") + except AttributeError as exc: + raise TypeError("RFC1123 object must be valid Datetime object.") from exc return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( Serializer.days[utc.tm_wday], @@ -1139,12 +1213,13 @@ def serialize_rfc(attr, **kwargs): ) @staticmethod - def serialize_iso(attr, **kwargs): + def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into ISO-8601 formatted string. :param Datetime attr: Object to be serialized. :rtype: str :raises: SerializationError if format invalid. + :return: serialized iso """ if isinstance(attr, str): attr = isodate.parse_datetime(attr) @@ -1170,13 +1245,14 @@ def serialize_iso(attr, **kwargs): raise TypeError(msg) from err @staticmethod - def serialize_unix(attr, **kwargs): + def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument """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 + :return: serialied unix """ if isinstance(attr, int): return attr @@ -1184,11 +1260,11 @@ def serialize_unix(attr, **kwargs): 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.") + except AttributeError as exc: + raise TypeError("Unix time object must be valid Datetime object.") from exc -def rest_key_extractor(attr, attr_desc, data): +def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument key = attr_desc["key"] working_data = data @@ -1209,7 +1285,9 @@ def rest_key_extractor(attr, attr_desc, data): return working_data.get(key) -def rest_key_case_insensitive_extractor(attr, attr_desc, data): +def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements + attr, attr_desc, data +): key = attr_desc["key"] working_data = data @@ -1230,17 +1308,29 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, 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.""" +def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + """Extract the attribute in "data" based on the last part of the JSON path key. + + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ 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): +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument """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" + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute """ key = attr_desc["key"] dict_keys = _FLATTEN.split(key) @@ -1277,7 +1367,7 @@ def _extract_name_from_internal_type(internal_type): return xml_name -def xml_key_extractor(attr, attr_desc, data): +def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements if isinstance(data, dict): return None @@ -1329,22 +1419,21 @@ def xml_key_extractor(attr, attr_desc, data): if is_iter_type: if is_wrapped: return None # is_wrapped no node, we want None - else: - return [] # not wrapped, assume empty list + 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 - ) + # 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( # pylint: disable=line-too-long + xml_name ) - return list(children[0]) # Might be empty list and that's ok. + ) + 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: @@ -1352,7 +1441,7 @@ def xml_key_extractor(attr, attr_desc, data): return children[0] -class Deserializer(object): +class Deserializer: """Response object model deserializer. :param dict classes: Class type dictionary for deserializing complex types. @@ -1361,9 +1450,9 @@ class Deserializer(object): 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}]?") + valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes: Optional[Mapping[str, type]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1401,11 +1490,12 @@ def __call__(self, target_obj, response_data, content_type=None): :param str content_type: Swagger "produces" if available. :raises: DeserializationError if deserialization fails. :return: Deserialized object. + :rtype: object """ data = self._unpack_content(response_data, content_type) return self._deserialize(target_obj, data) - def _deserialize(self, target_obj, data): + def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements """Call the deserializer on a model. Data needs to be already deserialized as JSON or XML ElementTree @@ -1414,12 +1504,13 @@ def _deserialize(self, target_obj, data): :param object data: Object to deserialize. :raises: DeserializationError if deserialization fails. :return: Deserialized object. + :rtype: 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(): + for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access if attr in constants: continue value = getattr(data, attr) @@ -1438,13 +1529,13 @@ def _deserialize(self, target_obj, data): if isinstance(response, str): return self.deserialize_data(data, response) - elif isinstance(response, type) and issubclass(response, Enum): + if isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) - if data is None: + if data is None or data is CoreNull: return data try: - attributes = response._attribute_map # type: ignore + attributes = response._attribute_map # type: ignore # pylint: disable=protected-access d_attrs = {} for attr, attr_desc in attributes.items(): # Check empty string. If it's not empty, someone has a real "additionalProperties"... @@ -1474,9 +1565,8 @@ def _deserialize(self, target_obj, data): except (AttributeError, TypeError, KeyError) as err: msg = "Unable to deserialize to object: " + class_name # type: ignore raise DeserializationError(msg) from err - else: - additional_properties = self._build_additional_properties(attributes, data) - return self._instantiate_model(response, d_attrs, additional_properties) + 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: @@ -1503,6 +1593,8 @@ def _classify_target(self, target, data): :param str target: The target object type to deserialize to. :param str/dict data: The response data to deserialize. + :return: The classified target object and its class name. + :rtype: tuple """ if target is None: return None, None @@ -1514,7 +1606,7 @@ def _classify_target(self, target, data): return target, target try: - target = target._classify(data, self.dependencies) # type: ignore + target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access except AttributeError: pass # Target is not a Model, no classify return target, target.__class__.__name__ # type: ignore @@ -1529,10 +1621,12 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): :param str target_obj: The target object type to deserialize to. :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. + :return: Deserialized object. + :rtype: object """ try: return self(target_obj, data, content_type=content_type) - except: + except: # pylint: disable=bare-except _LOGGER.debug( "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True ) @@ -1550,10 +1644,12 @@ def _unpack_content(raw_data, content_type=None): 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. + :param obj raw_data: Data to be processed. + :param str 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 + :rtype: object + :return: Unpacked content. """ # Assume this is enough to detect a Pipeline Response without importing it context = getattr(raw_data, "context", {}) @@ -1577,24 +1673,35 @@ def _unpack_content(raw_data, content_type=None): 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. + :param Response response: The response model class. + :param dict attrs: The deserialized response attributes. + :param dict additional_properties: Additional properties to be set. + :rtype: Response + :return: The instantiated response model. """ 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")] + readonly = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("readonly") + ] + const = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + 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 + response_obj.additional_properties = additional_properties # type: ignore return response_obj except TypeError as err: msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore - raise DeserializationError(msg + str(err)) + raise DeserializationError(msg + str(err)) from err else: try: for attr, value in attrs.items(): @@ -1603,15 +1710,16 @@ def _instantiate_model(self, response, attrs, additional_properties=None): except Exception as exp: msg = "Unable to populate response model. " msg += "Type: {}, Error: {}".format(type(response), exp) - raise DeserializationError(msg) + raise DeserializationError(msg) from exp - def deserialize_data(self, data, data_type): + def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements """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. + :rtype: object """ if data is None: return data @@ -1625,7 +1733,11 @@ def deserialize_data(self, data, data_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"{}"] + is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment + "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) @@ -1645,14 +1757,14 @@ def deserialize_data(self, data, data_type): msg = "Unable to deserialize response data." msg += " Data: {}, {}".format(data, data_type) raise DeserializationError(msg) from err - else: - return self._deserialize(obj_type, data) + 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. + :return: Deserialized iterable. :rtype: list """ if attr is None: @@ -1669,6 +1781,7 @@ def deserialize_dict(self, attr, dict_type): :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. + :return: Deserialized dictionary. :rtype: dict """ if isinstance(attr, list): @@ -1679,11 +1792,12 @@ def deserialize_dict(self, attr, dict_type): 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): + def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements """Deserialize a generic object. This will be handled as a dictionary. :param dict attr: Dictionary to be deserialized. + :return: Deserialized object. :rtype: dict :raises: TypeError if non-builtin datatype encountered. """ @@ -1718,11 +1832,10 @@ def deserialize_object(self, attr, **kwargs): pass return deserialized - else: - error = "Cannot deserialize generic object with type: " - raise TypeError(error + str(obj_type)) + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) - def deserialize_basic(self, attr, data_type): + def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements """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 @@ -1730,6 +1843,7 @@ def deserialize_basic(self, attr, data_type): :param str attr: response string to be deserialized. :param str data_type: deserialization data type. + :return: Deserialized basic type. :rtype: str, int, float or bool :raises: TypeError if string format is not valid. """ @@ -1741,24 +1855,23 @@ def deserialize_basic(self, attr, data_type): 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 + # 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, str): + if isinstance(attr, str): if attr.lower() in ["true", "1"]: return True - elif attr.lower() in ["false", "0"]: + if 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 + return eval(data_type)(attr) # nosec # pylint: disable=eval-used @staticmethod def deserialize_unicode(data): @@ -1766,6 +1879,7 @@ def deserialize_unicode(data): as a string. :param str data: response string to be deserialized. + :return: Deserialized string. :rtype: str or unicode """ # We might be here because we have an enum modeled as string, @@ -1779,8 +1893,7 @@ def deserialize_unicode(data): return data except NameError: return str(data) - else: - return str(data) + return str(data) @staticmethod def deserialize_enum(data, enum_obj): @@ -1792,6 +1905,7 @@ def deserialize_enum(data, enum_obj): :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. + :return: Deserialized enum object. :rtype: Enum """ if isinstance(data, enum_obj) or data is None: @@ -1802,9 +1916,9 @@ def deserialize_enum(data, enum_obj): # Workaround. We might consider remove it in the future. try: return list(enum_obj.__members__.values())[data] - except IndexError: + except IndexError as exc: error = "{!r} is not a valid index for enum {!r}" - raise DeserializationError(error.format(data, enum_obj)) + raise DeserializationError(error.format(data, enum_obj)) from exc try: return enum_obj(str(data)) except ValueError: @@ -1820,6 +1934,7 @@ def deserialize_bytearray(attr): """Deserialize string into bytearray. :param str attr: response string to be deserialized. + :return: Deserialized bytearray :rtype: bytearray :raises: TypeError if string format invalid. """ @@ -1832,6 +1947,7 @@ def deserialize_base64(attr): """Deserialize base64 encoded string into string. :param str attr: response string to be deserialized. + :return: Deserialized base64 string :rtype: bytearray :raises: TypeError if string format invalid. """ @@ -1847,8 +1963,9 @@ def deserialize_decimal(attr): """Deserialize string into Decimal object. :param str attr: response string to be deserialized. - :rtype: Decimal + :return: Deserialized decimal :raises: DeserializationError if string format invalid. + :rtype: decimal """ if isinstance(attr, ET.Element): attr = attr.text @@ -1863,6 +1980,7 @@ def deserialize_long(attr): """Deserialize string into long (Py2) or int (Py3). :param str attr: response string to be deserialized. + :return: Deserialized int :rtype: long or int :raises: ValueError if string format invalid. """ @@ -1875,6 +1993,7 @@ def deserialize_duration(attr): """Deserialize ISO-8601 formatted string into TimeDelta object. :param str attr: response string to be deserialized. + :return: Deserialized duration :rtype: TimeDelta :raises: DeserializationError if string format invalid. """ @@ -1885,14 +2004,14 @@ def deserialize_duration(attr): except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize duration object." raise DeserializationError(msg) from err - else: - return duration + return duration @staticmethod def deserialize_date(attr): """Deserialize ISO-8601 formatted string into Date object. :param str attr: response string to be deserialized. + :return: Deserialized date :rtype: Date :raises: DeserializationError if string format invalid. """ @@ -1908,6 +2027,7 @@ def deserialize_time(attr): """Deserialize ISO-8601 formatted string into time object. :param str attr: response string to be deserialized. + :return: Deserialized time :rtype: datetime.time :raises: DeserializationError if string format invalid. """ @@ -1922,6 +2042,7 @@ def deserialize_rfc(attr): """Deserialize RFC-1123 formatted string into Datetime object. :param str attr: response string to be deserialized. + :return: Deserialized RFC datetime :rtype: Datetime :raises: DeserializationError if string format invalid. """ @@ -1937,14 +2058,14 @@ def deserialize_rfc(attr): except ValueError as err: msg = "Cannot deserialize to rfc datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj @staticmethod def deserialize_iso(attr): """Deserialize ISO-8601 formatted string into Datetime object. :param str attr: response string to be deserialized. + :return: Deserialized ISO datetime :rtype: Datetime :raises: DeserializationError if string format invalid. """ @@ -1974,8 +2095,7 @@ def deserialize_iso(attr): except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj @staticmethod def deserialize_unix(attr): @@ -1983,6 +2103,7 @@ def deserialize_unix(attr): This is represented as seconds. :param int attr: Object to be serialized. + :return: Deserialized datetime :rtype: Datetime :raises: DeserializationError if format invalid """ @@ -1994,5 +2115,4 @@ def deserialize_unix(attr): except ValueError as err: msg = "Cannot deserialize to unix datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_vendor.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_vendor.py +++ /dev/null @@ -1,16 +0,0 @@ -# -------------------------------------------------------------------------- -# 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.pipeline.transport import HttpRequest - - -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) - if files: - request.set_formdata_body(files) - return request diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_version.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_version.py index f89ed38360ab..e5754a47ce68 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_version.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "9.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/__init__.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/__init__.py index 839d85e2e381..2f2a87dfd665 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/__init__.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/__init__.py @@ -5,12 +5,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._recovery_services_backup_passive_client import RecoveryServicesBackupPassiveClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._recovery_services_backup_passive_client import RecoveryServicesBackupPassiveClient # type: ignore try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -18,6 +24,6 @@ __all__ = [ "RecoveryServicesBackupPassiveClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/_configuration.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/_configuration.py index bbe77c7e23cf..d6909da32366 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/_configuration.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/_configuration.py @@ -14,7 +14,6 @@ from .._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/_recovery_services_backup_passive_client.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/_recovery_services_backup_passive_client.py index c0247092c44e..9791fde57f88 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/_recovery_services_backup_passive_client.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/_recovery_services_backup_passive_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -32,11 +33,10 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class RecoveryServicesBackupPassiveClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class RecoveryServicesBackupPassiveClient: # pylint: disable=too-many-instance-attributes """Open API 2.0 Specs for Azure RecoveryServices Backup service. :ivar backup_usage_summaries_crr: BackupUsageSummariesCRROperations operations @@ -174,7 +174,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "RecoveryServicesBackupPassiveClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/__init__.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/__init__.py index 2fc83cfb6d5a..62c2cdf28182 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/__init__.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/__init__.py @@ -5,21 +5,27 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._backup_usage_summaries_crr_operations import BackupUsageSummariesCRROperations -from ._aad_properties_operations import AadPropertiesOperations -from ._cross_region_restore_operations import CrossRegionRestoreOperations -from ._backup_crr_job_details_operations import BackupCrrJobDetailsOperations -from ._backup_crr_jobs_operations import BackupCrrJobsOperations -from ._crr_operation_results_operations import CrrOperationResultsOperations -from ._crr_operation_status_operations import CrrOperationStatusOperations -from ._recovery_points_operations import RecoveryPointsOperations -from ._backup_resource_storage_configs_operations import BackupResourceStorageConfigsOperations -from ._recovery_points_crr_operations import RecoveryPointsCrrOperations -from ._backup_protected_items_crr_operations import BackupProtectedItemsCrrOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._backup_usage_summaries_crr_operations import BackupUsageSummariesCRROperations # type: ignore +from ._aad_properties_operations import AadPropertiesOperations # type: ignore +from ._cross_region_restore_operations import CrossRegionRestoreOperations # type: ignore +from ._backup_crr_job_details_operations import BackupCrrJobDetailsOperations # type: ignore +from ._backup_crr_jobs_operations import BackupCrrJobsOperations # type: ignore +from ._crr_operation_results_operations import CrrOperationResultsOperations # type: ignore +from ._crr_operation_status_operations import CrrOperationStatusOperations # type: ignore +from ._recovery_points_operations import RecoveryPointsOperations # type: ignore +from ._backup_resource_storage_configs_operations import BackupResourceStorageConfigsOperations # type: ignore +from ._recovery_points_crr_operations import RecoveryPointsCrrOperations # type: ignore +from ._backup_protected_items_crr_operations import BackupProtectedItemsCrrOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -35,5 +41,5 @@ "RecoveryPointsCrrOperations", "BackupProtectedItemsCrrOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_aad_properties_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_aad_properties_operations.py index 3aaef7bf2c9d..9183dd60e1cd 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_aad_properties_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_aad_properties_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -17,16 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest 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._aad_properties_operations import build_get_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -66,7 +68,7 @@ async def get( :rtype: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.AADPropertiesResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -88,7 +90,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -103,7 +104,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AADPropertiesResource", pipeline_response) + deserialized = self._deserialize("AADPropertiesResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_crr_job_details_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_crr_job_details_operations.py index 633048e26297..a809815315bf 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_crr_job_details_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_crr_job_details_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -18,16 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest 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._backup_crr_job_details_operations import build_get_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -114,7 +116,7 @@ async def get( :rtype: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.JobResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -147,7 +149,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -162,7 +163,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("JobResource", pipeline_response) + deserialized = self._deserialize("JobResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_crr_jobs_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_crr_jobs_operations.py index b354f0cb570f..78bc2b764213 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_crr_jobs_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_crr_jobs_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -20,16 +20,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 from ...operations._backup_crr_jobs_operations import build_list_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -152,7 +154,7 @@ def list( content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -182,7 +184,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -198,7 +199,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_protected_items_crr_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_protected_items_crr_operations.py index 04b703505c9d..6dfdebb9a8c9 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_protected_items_crr_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_protected_items_crr_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -19,16 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 from ...operations._backup_protected_items_crr_operations import build_list_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -61,6 +63,7 @@ def list( skip_token: Optional[str] = None, **kwargs: Any ) -> AsyncIterable["_models.ProtectedItemResource"]: + # pylint: disable=line-too-long """Provides a pageable list of all items that are backed up within a vault. :param vault_name: The name of the recovery services vault. Required. @@ -84,7 +87,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ProtectedItemResourceList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -105,7 +108,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -121,7 +123,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_resource_storage_configs_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_resource_storage_configs_operations.py index 3f6f4e28391b..30f2b9dfab84 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_resource_storage_configs_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_resource_storage_configs_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -18,20 +18,22 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest 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._backup_resource_storage_configs_operations import ( build_get_request, build_patch_request, build_update_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,7 +72,7 @@ async def get( :rtype: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupResourceConfigResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -92,7 +94,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -107,7 +108,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupResourceConfigResource", pipeline_response) + deserialized = self._deserialize("BackupResourceConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -193,7 +194,7 @@ async def update( :rtype: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupResourceConfigResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -227,7 +228,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -242,7 +242,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupResourceConfigResource", pipeline_response) + deserialized = self._deserialize("BackupResourceConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -250,7 +250,7 @@ async def update( return deserialized # type: ignore @overload - async def patch( # pylint: disable=inconsistent-return-statements + async def patch( self, vault_name: str, resource_group_name: str, @@ -278,7 +278,7 @@ async def patch( # pylint: disable=inconsistent-return-statements """ @overload - async def patch( # pylint: disable=inconsistent-return-statements + async def patch( self, vault_name: str, resource_group_name: str, @@ -305,7 +305,7 @@ async def patch( # pylint: disable=inconsistent-return-statements """ @distributed_trace_async - async def patch( # pylint: disable=inconsistent-return-statements + async def patch( self, vault_name: str, resource_group_name: str, @@ -328,7 +328,7 @@ async def patch( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -362,7 +362,6 @@ async def patch( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_usage_summaries_crr_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_usage_summaries_crr_operations.py index dcbda00aa786..c337a32779ce 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_usage_summaries_crr_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_usage_summaries_crr_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -19,16 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 from ...operations._backup_usage_summaries_crr_operations import build_list_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -61,6 +63,7 @@ def list( skip_token: Optional[str] = None, **kwargs: Any ) -> AsyncIterable["_models.BackupManagementUsage"]: + # pylint: disable=line-too-long """Fetches the backup management usage summaries of the vault. :param vault_name: The name of the recovery services vault. Required. @@ -84,7 +87,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BackupManagementUsageList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -105,7 +108,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -121,7 +123,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_cross_region_restore_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_cross_region_restore_operations.py index 5ebb45d3ada9..5233859af7f2 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_cross_region_restore_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_cross_region_restore_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,21 +15,25 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest 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 azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._cross_region_restore_operations import build_trigger_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -53,10 +57,10 @@ def __init__(self, *args, **kwargs) -> None: 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") - async def _trigger_initial( # pylint: disable=inconsistent-return-statements + async def _trigger_initial( self, azure_region: str, parameters: Union[_models.CrossRegionRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -69,7 +73,7 @@ async def _trigger_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -89,10 +93,10 @@ async def _trigger_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -100,12 +104,20 @@ async def _trigger_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_trigger( @@ -187,7 +199,7 @@ async def begin_trigger( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._trigger_initial( # type: ignore + raw_result = await self._trigger_initial( azure_region=azure_region, parameters=parameters, api_version=api_version, @@ -197,6 +209,7 @@ async def begin_trigger( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_crr_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_crr_operation_results_operations.py index ab856b952bbc..456435abfe0b 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_crr_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_crr_operation_results_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -17,16 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest 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._crr_operation_results_operations import build_get_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -51,9 +53,7 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def get( # pylint: disable=inconsistent-return-statements - self, azure_region: str, operation_id: str, **kwargs: Any - ) -> None: + async def get(self, azure_region: str, operation_id: str, **kwargs: Any) -> None: """get. :param azure_region: Azure region to hit Api. Required. @@ -64,7 +64,7 @@ async def get( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -86,7 +86,6 @@ async def get( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_crr_operation_status_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_crr_operation_status_operations.py index ec37f0659c1e..712e1d4569f5 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_crr_operation_status_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_crr_operation_status_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -17,16 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest 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._crr_operation_status_operations import build_get_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -62,7 +64,7 @@ async def get(self, azure_region: str, operation_id: str, **kwargs: Any) -> _mod :rtype: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.OperationStatus :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -84,7 +86,6 @@ async def get(self, azure_region: str, operation_id: str, **kwargs: Any) -> _mod headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -99,7 +100,7 @@ async def get(self, azure_region: str, operation_id: str, **kwargs: Any) -> _mod error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("OperationStatus", pipeline_response) + deserialized = self._deserialize("OperationStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_recovery_points_crr_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_recovery_points_crr_operations.py index bd113862648f..69941100210a 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_recovery_points_crr_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_recovery_points_crr_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -19,17 +19,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._recovery_points_crr_operations import build_get_request, build_list_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +66,7 @@ def list( filter: Optional[str] = None, **kwargs: Any ) -> AsyncIterable["_models.RecoveryPointResource"]: + # pylint: disable=line-too-long """Lists the backup copies for the backed up item. :param vault_name: The name of the recovery services vault. Required. @@ -91,7 +94,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RecoveryPointResourceList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -114,7 +117,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -130,7 +132,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -192,7 +193,7 @@ async def get( :rtype: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.RecoveryPointResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -218,7 +219,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -233,7 +233,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecoveryPointResource", pipeline_response) + deserialized = self._deserialize("RecoveryPointResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_recovery_points_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_recovery_points_operations.py index 527224916c15..0e9fa42749d1 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_recovery_points_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_recovery_points_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -18,16 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest 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._recovery_points_operations import build_get_access_token_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -170,12 +172,11 @@ async def get_access_token( :rtype: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.CrrAccessTokenResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError, - 400: lambda response: HttpResponseError(response=response, error_format=ARMErrorFormat), } error_map.update(kwargs.pop("error_map", {}) or {}) @@ -209,7 +210,6 @@ async def get_access_token( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -224,7 +224,7 @@ async def get_access_token( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CrrAccessTokenResource", pipeline_response) + deserialized = self._deserialize("CrrAccessTokenResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/models/__init__.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/models/__init__.py index 4d165128ead5..d4b88bc19dc2 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/models/__init__.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/models/__init__.py @@ -5,161 +5,172 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._models_py3 import AADProperties -from ._models_py3 import AADPropertiesResource -from ._models_py3 import AzureFileShareRecoveryPoint -from ._models_py3 import AzureFileShareRestoreRequest -from ._models_py3 import AzureFileshareProtectedItem -from ._models_py3 import AzureFileshareProtectedItemExtendedInfo -from ._models_py3 import AzureIaaSClassicComputeVMProtectedItem -from ._models_py3 import AzureIaaSComputeVMProtectedItem -from ._models_py3 import AzureIaaSVMErrorInfo -from ._models_py3 import AzureIaaSVMHealthDetails -from ._models_py3 import AzureIaaSVMJob -from ._models_py3 import AzureIaaSVMJobExtendedInfo -from ._models_py3 import AzureIaaSVMJobTaskDetails -from ._models_py3 import AzureIaaSVMProtectedItem -from ._models_py3 import AzureIaaSVMProtectedItemExtendedInfo -from ._models_py3 import AzureSqlProtectedItem -from ._models_py3 import AzureSqlProtectedItemExtendedInfo -from ._models_py3 import AzureStorageErrorInfo -from ._models_py3 import AzureStorageJob -from ._models_py3 import AzureStorageJobExtendedInfo -from ._models_py3 import AzureStorageJobTaskDetails -from ._models_py3 import AzureVmWorkloadProtectedItem -from ._models_py3 import AzureVmWorkloadProtectedItemExtendedInfo -from ._models_py3 import AzureVmWorkloadSAPAseDatabaseProtectedItem -from ._models_py3 import AzureVmWorkloadSAPHanaDatabaseProtectedItem -from ._models_py3 import AzureVmWorkloadSQLDatabaseProtectedItem -from ._models_py3 import AzureWorkloadErrorInfo -from ._models_py3 import AzureWorkloadJob -from ._models_py3 import AzureWorkloadJobExtendedInfo -from ._models_py3 import AzureWorkloadJobTaskDetails -from ._models_py3 import AzureWorkloadPointInTimeRecoveryPoint -from ._models_py3 import AzureWorkloadPointInTimeRestoreRequest -from ._models_py3 import AzureWorkloadRecoveryPoint -from ._models_py3 import AzureWorkloadRestoreRequest -from ._models_py3 import AzureWorkloadSAPHanaPointInTimeRecoveryPoint -from ._models_py3 import AzureWorkloadSAPHanaPointInTimeRestoreRequest -from ._models_py3 import AzureWorkloadSAPHanaRecoveryPoint -from ._models_py3 import AzureWorkloadSAPHanaRestoreRequest -from ._models_py3 import AzureWorkloadSQLPointInTimeRecoveryPoint -from ._models_py3 import AzureWorkloadSQLPointInTimeRestoreRequest -from ._models_py3 import AzureWorkloadSQLRecoveryPoint -from ._models_py3 import AzureWorkloadSQLRecoveryPointExtendedInfo -from ._models_py3 import AzureWorkloadSQLRestoreRequest -from ._models_py3 import BEKDetails -from ._models_py3 import BMSAADPropertiesQueryObject -from ._models_py3 import BMSBackupSummariesQueryObject -from ._models_py3 import BMSRPQueryObject -from ._models_py3 import BackupManagementUsage -from ._models_py3 import BackupManagementUsageList -from ._models_py3 import BackupResourceConfig -from ._models_py3 import BackupResourceConfigResource -from ._models_py3 import ClientScriptForConnect -from ._models_py3 import CrossRegionRestoreRequest -from ._models_py3 import CrossRegionRestoreRequestResource -from ._models_py3 import CrrAccessToken -from ._models_py3 import CrrAccessTokenResource -from ._models_py3 import CrrJobRequest -from ._models_py3 import CrrJobRequestResource -from ._models_py3 import DPMProtectedItem -from ._models_py3 import DPMProtectedItemExtendedInfo -from ._models_py3 import DiskExclusionProperties -from ._models_py3 import DiskInformation -from ._models_py3 import DpmErrorInfo -from ._models_py3 import DpmJob -from ._models_py3 import DpmJobExtendedInfo -from ._models_py3 import DpmJobTaskDetails -from ._models_py3 import EncryptionDetails -from ._models_py3 import ErrorAdditionalInfo -from ._models_py3 import ErrorDetail -from ._models_py3 import ExtendedProperties -from ._models_py3 import GenericProtectedItem -from ._models_py3 import GenericRecoveryPoint -from ._models_py3 import IaasVMRecoveryPoint -from ._models_py3 import IaasVMRestoreRequest -from ._models_py3 import IdentityBasedRestoreDetails -from ._models_py3 import IdentityInfo -from ._models_py3 import InstantItemRecoveryTarget -from ._models_py3 import Job -from ._models_py3 import JobQueryObject -from ._models_py3 import JobResource -from ._models_py3 import JobResourceList -from ._models_py3 import KEKDetails -from ._models_py3 import KPIResourceHealthDetails -from ._models_py3 import KeyAndSecretDetails -from ._models_py3 import MabErrorInfo -from ._models_py3 import MabFileFolderProtectedItem -from ._models_py3 import MabFileFolderProtectedItemExtendedInfo -from ._models_py3 import MabJob -from ._models_py3 import MabJobExtendedInfo -from ._models_py3 import MabJobTaskDetails -from ._models_py3 import NameInfo -from ._models_py3 import NewErrorResponse -from ._models_py3 import NewErrorResponseError -from ._models_py3 import OperationStatus -from ._models_py3 import OperationStatusError -from ._models_py3 import OperationStatusExtendedInfo -from ._models_py3 import OperationStatusJobExtendedInfo -from ._models_py3 import OperationStatusJobsExtendedInfo -from ._models_py3 import OperationStatusProvisionILRExtendedInfo -from ._models_py3 import OperationStatusRecoveryPointExtendedInfo -from ._models_py3 import PointInTimeRange -from ._models_py3 import ProtectedItem -from ._models_py3 import ProtectedItemQueryObject -from ._models_py3 import ProtectedItemResource -from ._models_py3 import ProtectedItemResourceList -from ._models_py3 import RecoveryPoint -from ._models_py3 import RecoveryPointDiskConfiguration -from ._models_py3 import RecoveryPointMoveReadinessInfo -from ._models_py3 import RecoveryPointResource -from ._models_py3 import RecoveryPointResourceList -from ._models_py3 import RecoveryPointTierInformation -from ._models_py3 import Resource -from ._models_py3 import ResourceHealthDetails -from ._models_py3 import ResourceList -from ._models_py3 import RestoreFileSpecs -from ._models_py3 import RestoreRequest -from ._models_py3 import SQLDataDirectory -from ._models_py3 import SQLDataDirectoryMapping -from ._models_py3 import TargetAFSRestoreInfo -from ._models_py3 import TargetRestoreInfo -from ._models_py3 import WorkloadCrrAccessToken +from typing import TYPE_CHECKING -from ._recovery_services_backup_passive_client_enums import BackupManagementType -from ._recovery_services_backup_passive_client_enums import CopyOptions -from ._recovery_services_backup_passive_client_enums import CreateMode -from ._recovery_services_backup_passive_client_enums import DataSourceType -from ._recovery_services_backup_passive_client_enums import HealthState -from ._recovery_services_backup_passive_client_enums import HealthStatus -from ._recovery_services_backup_passive_client_enums import JobOperationType -from ._recovery_services_backup_passive_client_enums import JobStatus -from ._recovery_services_backup_passive_client_enums import JobSupportedAction -from ._recovery_services_backup_passive_client_enums import LastBackupStatus -from ._recovery_services_backup_passive_client_enums import MabServerType -from ._recovery_services_backup_passive_client_enums import OperationStatusValues -from ._recovery_services_backup_passive_client_enums import OverwriteOptions -from ._recovery_services_backup_passive_client_enums import ProtectedItemHealthStatus -from ._recovery_services_backup_passive_client_enums import ProtectedItemState -from ._recovery_services_backup_passive_client_enums import ProtectionState -from ._recovery_services_backup_passive_client_enums import RecoveryMode -from ._recovery_services_backup_passive_client_enums import RecoveryPointTierStatus -from ._recovery_services_backup_passive_client_enums import RecoveryPointTierType -from ._recovery_services_backup_passive_client_enums import RecoveryType -from ._recovery_services_backup_passive_client_enums import ResourceHealthStatus -from ._recovery_services_backup_passive_client_enums import RestorePointQueryType -from ._recovery_services_backup_passive_client_enums import RestorePointType -from ._recovery_services_backup_passive_client_enums import RestoreRequestType -from ._recovery_services_backup_passive_client_enums import SQLDataDirectoryType -from ._recovery_services_backup_passive_client_enums import StorageType -from ._recovery_services_backup_passive_client_enums import StorageTypeState -from ._recovery_services_backup_passive_client_enums import Type -from ._recovery_services_backup_passive_client_enums import UsagesUnit -from ._recovery_services_backup_passive_client_enums import WorkloadType +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + AADProperties, + AADPropertiesResource, + AzureFileShareRecoveryPoint, + AzureFileShareRestoreRequest, + AzureFileshareProtectedItem, + AzureFileshareProtectedItemExtendedInfo, + AzureIaaSClassicComputeVMProtectedItem, + AzureIaaSComputeVMProtectedItem, + AzureIaaSVMErrorInfo, + AzureIaaSVMHealthDetails, + AzureIaaSVMJob, + AzureIaaSVMJobExtendedInfo, + AzureIaaSVMJobTaskDetails, + AzureIaaSVMProtectedItem, + AzureIaaSVMProtectedItemExtendedInfo, + AzureSqlProtectedItem, + AzureSqlProtectedItemExtendedInfo, + AzureStorageErrorInfo, + AzureStorageJob, + AzureStorageJobExtendedInfo, + AzureStorageJobTaskDetails, + AzureVmWorkloadProtectedItem, + AzureVmWorkloadProtectedItemExtendedInfo, + AzureVmWorkloadSAPAseDatabaseProtectedItem, + AzureVmWorkloadSAPHanaDatabaseProtectedItem, + AzureVmWorkloadSQLDatabaseProtectedItem, + AzureWorkloadErrorInfo, + AzureWorkloadJob, + AzureWorkloadJobExtendedInfo, + AzureWorkloadJobTaskDetails, + AzureWorkloadPointInTimeRecoveryPoint, + AzureWorkloadPointInTimeRestoreRequest, + AzureWorkloadRecoveryPoint, + AzureWorkloadRestoreRequest, + AzureWorkloadSAPHanaPointInTimeRecoveryPoint, + AzureWorkloadSAPHanaPointInTimeRestoreRequest, + AzureWorkloadSAPHanaRecoveryPoint, + AzureWorkloadSAPHanaRestoreRequest, + AzureWorkloadSQLPointInTimeRecoveryPoint, + AzureWorkloadSQLPointInTimeRestoreRequest, + AzureWorkloadSQLRecoveryPoint, + AzureWorkloadSQLRecoveryPointExtendedInfo, + AzureWorkloadSQLRestoreRequest, + BEKDetails, + BMSAADPropertiesQueryObject, + BMSBackupSummariesQueryObject, + BMSRPQueryObject, + BackupManagementUsage, + BackupManagementUsageList, + BackupResourceConfig, + BackupResourceConfigResource, + ClientScriptForConnect, + CrossRegionRestoreRequest, + CrossRegionRestoreRequestResource, + CrrAccessToken, + CrrAccessTokenResource, + CrrJobRequest, + CrrJobRequestResource, + DPMProtectedItem, + DPMProtectedItemExtendedInfo, + DiskExclusionProperties, + DiskInformation, + DpmErrorInfo, + DpmJob, + DpmJobExtendedInfo, + DpmJobTaskDetails, + EncryptionDetails, + ErrorAdditionalInfo, + ErrorDetail, + ExtendedProperties, + GenericProtectedItem, + GenericRecoveryPoint, + IaasVMRecoveryPoint, + IaasVMRestoreRequest, + IdentityBasedRestoreDetails, + IdentityInfo, + InstantItemRecoveryTarget, + Job, + JobQueryObject, + JobResource, + JobResourceList, + KEKDetails, + KPIResourceHealthDetails, + KeyAndSecretDetails, + MabErrorInfo, + MabFileFolderProtectedItem, + MabFileFolderProtectedItemExtendedInfo, + MabJob, + MabJobExtendedInfo, + MabJobTaskDetails, + NameInfo, + NewErrorResponse, + NewErrorResponseError, + OperationStatus, + OperationStatusError, + OperationStatusExtendedInfo, + OperationStatusJobExtendedInfo, + OperationStatusJobsExtendedInfo, + OperationStatusProvisionILRExtendedInfo, + OperationStatusRecoveryPointExtendedInfo, + PointInTimeRange, + ProtectedItem, + ProtectedItemQueryObject, + ProtectedItemResource, + ProtectedItemResourceList, + RecoveryPoint, + RecoveryPointDiskConfiguration, + RecoveryPointMoveReadinessInfo, + RecoveryPointResource, + RecoveryPointResourceList, + RecoveryPointTierInformation, + Resource, + ResourceHealthDetails, + ResourceList, + RestoreFileSpecs, + RestoreRequest, + SQLDataDirectory, + SQLDataDirectoryMapping, + TargetAFSRestoreInfo, + TargetRestoreInfo, + WorkloadCrrAccessToken, +) + +from ._recovery_services_backup_passive_client_enums import ( # type: ignore + BackupManagementType, + CopyOptions, + CreateMode, + DataSourceType, + HealthState, + HealthStatus, + JobOperationType, + JobStatus, + JobSupportedAction, + LastBackupStatus, + MabServerType, + OperationStatusValues, + OverwriteOptions, + ProtectedItemHealthStatus, + ProtectedItemState, + ProtectionState, + RecoveryMode, + RecoveryPointTierStatus, + RecoveryPointTierType, + RecoveryType, + ResourceHealthStatus, + RestorePointQueryType, + RestorePointType, + RestoreRequestType, + SQLDataDirectoryType, + StorageType, + StorageTypeState, + Type, + UsagesUnit, + WorkloadType, +) from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -315,5 +326,5 @@ "UsagesUnit", "WorkloadType", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/models/_models_py3.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/models/_models_py3.py index 1851e59aee15..4bd9dc2e3a6a 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/models/_models_py3.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/models/_models_py3.py @@ -1,5 +1,5 @@ -# coding=utf-8 # pylint: disable=too-many-lines +# 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. @@ -13,7 +13,6 @@ from .. import _serialization if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from .. import models as _models @@ -191,7 +190,7 @@ def __init__( self.properties = properties -class ProtectedItem(_serialization.Model): # pylint: disable=too-many-instance-attributes +class ProtectedItem(_serialization.Model): """Base class for backup items. You probably want to use the sub-classes and not this class directly. Known sub-classes are: @@ -361,7 +360,7 @@ def __init__( self.resource_guard_operation_requests = resource_guard_operation_requests -class AzureFileshareProtectedItem(ProtectedItem): # pylint: disable=too-many-instance-attributes +class AzureFileshareProtectedItem(ProtectedItem): """Azure File Share workload-specific backup item. All required parameters must be populated in order to send to server. @@ -851,7 +850,7 @@ def __init__( self.target_details = target_details -class AzureIaaSVMProtectedItem(ProtectedItem): # pylint: disable=too-many-instance-attributes +class AzureIaaSVMProtectedItem(ProtectedItem): """IaaS VM workload-specific backup item. You probably want to use the sub-classes and not this class directly. Known sub-classes are: @@ -1119,7 +1118,7 @@ def __init__( # pylint: disable=too-many-locals self.extended_properties = extended_properties -class AzureIaaSClassicComputeVMProtectedItem(AzureIaaSVMProtectedItem): # pylint: disable=too-many-instance-attributes +class AzureIaaSClassicComputeVMProtectedItem(AzureIaaSVMProtectedItem): """IaaS VM workload-specific backup item representing the Classic Compute VM. All required parameters must be populated in order to send to server. @@ -1377,7 +1376,7 @@ def __init__( # pylint: disable=too-many-locals self.protected_item_type: str = "Microsoft.ClassicCompute/virtualMachines" -class AzureIaaSComputeVMProtectedItem(AzureIaaSVMProtectedItem): # pylint: disable=too-many-instance-attributes +class AzureIaaSComputeVMProtectedItem(AzureIaaSVMProtectedItem): """IaaS VM workload-specific backup item representing the Azure Resource Manager VM. All required parameters must be populated in order to send to server. @@ -1825,7 +1824,7 @@ def __init__( self.job_type: Optional[str] = None -class AzureIaaSVMJob(Job): # pylint: disable=too-many-instance-attributes +class AzureIaaSVMJob(Job): """Azure IaaS VM workload-specific job object. All required parameters must be populated in order to send to server. @@ -2136,7 +2135,7 @@ def __init__( self.policy_inconsistent = policy_inconsistent -class AzureSqlProtectedItem(ProtectedItem): # pylint: disable=too-many-instance-attributes +class AzureSqlProtectedItem(ProtectedItem): """Azure SQL workload-specific backup item. All required parameters must be populated in order to send to server. @@ -2400,7 +2399,7 @@ def __init__( self.recommendations = recommendations -class AzureStorageJob(Job): # pylint: disable=too-many-instance-attributes +class AzureStorageJob(Job): """Azure storage specific job. All required parameters must be populated in order to send to server. @@ -2604,7 +2603,7 @@ def __init__(self, *, task_id: Optional[str] = None, status: Optional[str] = Non self.status = status -class AzureVmWorkloadProtectedItem(ProtectedItem): # pylint: disable=too-many-instance-attributes +class AzureVmWorkloadProtectedItem(ProtectedItem): """Azure VM workload-specific protected item. You probably want to use the sub-classes and not this class directly. Known sub-classes are: @@ -2926,9 +2925,7 @@ def __init__( self.policy_state = policy_state -class AzureVmWorkloadSAPAseDatabaseProtectedItem( - AzureVmWorkloadProtectedItem -): # pylint: disable=too-many-instance-attributes,name-too-long +class AzureVmWorkloadSAPAseDatabaseProtectedItem(AzureVmWorkloadProtectedItem): # pylint: disable=name-too-long """Azure VM workload-specific protected item representing SAP ASE Database. All required parameters must be populated in order to send to server. @@ -3197,9 +3194,7 @@ def __init__( # pylint: disable=too-many-locals self.protected_item_type: str = "AzureVmWorkloadSAPAseDatabase" -class AzureVmWorkloadSAPHanaDatabaseProtectedItem( - AzureVmWorkloadProtectedItem -): # pylint: disable=too-many-instance-attributes,name-too-long +class AzureVmWorkloadSAPHanaDatabaseProtectedItem(AzureVmWorkloadProtectedItem): # pylint: disable=name-too-long """Azure VM workload-specific protected item representing SAP HANA Database. All required parameters must be populated in order to send to server. @@ -3468,9 +3463,7 @@ def __init__( # pylint: disable=too-many-locals self.protected_item_type: str = "AzureVmWorkloadSAPHanaDatabase" -class AzureVmWorkloadSQLDatabaseProtectedItem( - AzureVmWorkloadProtectedItem -): # pylint: disable=too-many-instance-attributes +class AzureVmWorkloadSQLDatabaseProtectedItem(AzureVmWorkloadProtectedItem): """Azure VM workload-specific protected item representing SQL Database. All required parameters must be populated in order to send to server. @@ -3792,7 +3785,7 @@ def __init__( self.additional_details = additional_details -class AzureWorkloadJob(Job): # pylint: disable=too-many-instance-attributes +class AzureWorkloadJob(Job): """Azure storage specific job. All required parameters must be populated in order to send to server. @@ -4960,9 +4953,7 @@ def __init__( self.alternate_directory_paths = alternate_directory_paths -class AzureWorkloadSQLPointInTimeRestoreRequest( - AzureWorkloadSQLRestoreRequest -): # pylint: disable=too-many-instance-attributes,name-too-long +class AzureWorkloadSQLPointInTimeRestoreRequest(AzureWorkloadSQLRestoreRequest): # pylint: disable=name-too-long """AzureWorkload SQL -specific restore. Specifically for PointInTime/Log restore. All required parameters must be populated in order to send to server. @@ -5628,7 +5619,7 @@ def __init__( self.properties = properties -class CrrAccessToken(_serialization.Model): # pylint: disable=too-many-instance-attributes +class CrrAccessToken(_serialization.Model): """CrrAccessToken. You probably want to use the sub-classes and not this class directly. Known sub-classes are: @@ -6075,7 +6066,7 @@ def __init__( self.recommendations = recommendations -class DpmJob(Job): # pylint: disable=too-many-instance-attributes +class DpmJob(Job): """DPM workload-specific job object. All required parameters must be populated in order to send to server. @@ -6318,7 +6309,7 @@ def __init__( self.status = status -class DPMProtectedItem(ProtectedItem): # pylint: disable=too-many-instance-attributes +class DPMProtectedItem(ProtectedItem): """Additional information on Backup engine specific backup item. All required parameters must be populated in order to send to server. @@ -6508,7 +6499,7 @@ def __init__( self.extended_info = extended_info -class DPMProtectedItemExtendedInfo(_serialization.Model): # pylint: disable=too-many-instance-attributes +class DPMProtectedItemExtendedInfo(_serialization.Model): """Additional information of DPM Protected item. :ivar protectable_object_load_path: Attribute to provide information on various DBs. @@ -6764,7 +6755,7 @@ def __init__( self.disk_exclusion_properties = disk_exclusion_properties -class GenericProtectedItem(ProtectedItem): # pylint: disable=too-many-instance-attributes +class GenericProtectedItem(ProtectedItem): """Base class for backup items. All required parameters must be populated in order to send to server. @@ -7028,7 +7019,7 @@ def __init__( self.recovery_point_additional_info = recovery_point_additional_info -class IaasVMRecoveryPoint(RecoveryPoint): # pylint: disable=too-many-instance-attributes +class IaasVMRecoveryPoint(RecoveryPoint): """IaaS VM workload specific backup copy. Variables are only populated by the server, and will be ignored when sending a request. @@ -7175,7 +7166,7 @@ def __init__( self.recovery_point_move_readiness_info = recovery_point_move_readiness_info -class IaasVMRestoreRequest(RestoreRequest): # pylint: disable=too-many-instance-attributes +class IaasVMRestoreRequest(RestoreRequest): """IaaS VM workload-specific restore. All required parameters must be populated in order to send to server. @@ -7819,7 +7810,7 @@ def __init__(self, **kwargs: Any) -> None: self.recommendations = None -class MabFileFolderProtectedItem(ProtectedItem): # pylint: disable=too-many-instance-attributes +class MabFileFolderProtectedItem(ProtectedItem): """MAB workload-specific backup item. All required parameters must be populated in order to send to server. @@ -8065,7 +8056,7 @@ def __init__( self.recovery_point_count = recovery_point_count -class MabJob(Job): # pylint: disable=too-many-instance-attributes +class MabJob(Job): """MAB workload-specific job. All required parameters must be populated in order to send to server. @@ -9350,7 +9341,7 @@ def __init__( self.target_directory_for_file_restore = target_directory_for_file_restore -class WorkloadCrrAccessToken(CrrAccessToken): # pylint: disable=too-many-instance-attributes +class WorkloadCrrAccessToken(CrrAccessToken): """WorkloadCrrAccessToken. All required parameters must be populated in order to send to server. diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/__init__.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/__init__.py index 2fc83cfb6d5a..62c2cdf28182 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/__init__.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/__init__.py @@ -5,21 +5,27 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._backup_usage_summaries_crr_operations import BackupUsageSummariesCRROperations -from ._aad_properties_operations import AadPropertiesOperations -from ._cross_region_restore_operations import CrossRegionRestoreOperations -from ._backup_crr_job_details_operations import BackupCrrJobDetailsOperations -from ._backup_crr_jobs_operations import BackupCrrJobsOperations -from ._crr_operation_results_operations import CrrOperationResultsOperations -from ._crr_operation_status_operations import CrrOperationStatusOperations -from ._recovery_points_operations import RecoveryPointsOperations -from ._backup_resource_storage_configs_operations import BackupResourceStorageConfigsOperations -from ._recovery_points_crr_operations import RecoveryPointsCrrOperations -from ._backup_protected_items_crr_operations import BackupProtectedItemsCrrOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._backup_usage_summaries_crr_operations import BackupUsageSummariesCRROperations # type: ignore +from ._aad_properties_operations import AadPropertiesOperations # type: ignore +from ._cross_region_restore_operations import CrossRegionRestoreOperations # type: ignore +from ._backup_crr_job_details_operations import BackupCrrJobDetailsOperations # type: ignore +from ._backup_crr_jobs_operations import BackupCrrJobsOperations # type: ignore +from ._crr_operation_results_operations import CrrOperationResultsOperations # type: ignore +from ._crr_operation_status_operations import CrrOperationStatusOperations # type: ignore +from ._recovery_points_operations import RecoveryPointsOperations # type: ignore +from ._backup_resource_storage_configs_operations import BackupResourceStorageConfigsOperations # type: ignore +from ._recovery_points_crr_operations import RecoveryPointsCrrOperations # type: ignore +from ._backup_protected_items_crr_operations import BackupProtectedItemsCrrOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -35,5 +41,5 @@ "RecoveryPointsCrrOperations", "BackupProtectedItemsCrrOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_aad_properties_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_aad_properties_operations.py index 500f862a4d1b..83cd3d250007 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_aad_properties_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_aad_properties_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -17,16 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -99,7 +101,7 @@ def get(self, azure_region: str, filter: Optional[str] = None, **kwargs: Any) -> :rtype: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.AADPropertiesResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -121,7 +123,6 @@ def get(self, azure_region: str, filter: Optional[str] = None, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -136,7 +137,7 @@ def get(self, azure_region: str, filter: Optional[str] = None, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AADPropertiesResource", pipeline_response) + deserialized = self._deserialize("AADPropertiesResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_crr_job_details_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_crr_job_details_operations.py index c2ab6f847e86..0a265bf25cff 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_crr_job_details_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_crr_job_details_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -18,16 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -148,7 +150,7 @@ def get( :rtype: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.JobResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -181,7 +183,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -196,7 +197,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("JobResource", pipeline_response) + deserialized = self._deserialize("JobResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_crr_jobs_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_crr_jobs_operations.py index 8a233d1029b0..69f708826a85 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_crr_jobs_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_crr_jobs_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -20,16 +20,18 @@ ) 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.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -197,7 +199,7 @@ def list( content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -227,7 +229,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -243,7 +244,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_protected_items_crr_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_protected_items_crr_operations.py index ee45d1998f1f..4fed2de6e5a9 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_protected_items_crr_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_protected_items_crr_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -19,16 +19,18 @@ ) 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.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -128,7 +130,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ProtectedItemResourceList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -149,7 +151,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -165,7 +166,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_resource_storage_configs_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_resource_storage_configs_operations.py index 4f9516b89780..65fa111df601 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_resource_storage_configs_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_resource_storage_configs_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -18,16 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -160,7 +162,7 @@ def get(self, vault_name: str, resource_group_name: str, **kwargs: Any) -> _mode :rtype: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupResourceConfigResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -182,7 +184,6 @@ def get(self, vault_name: str, resource_group_name: str, **kwargs: Any) -> _mode headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -197,7 +198,7 @@ def get(self, vault_name: str, resource_group_name: str, **kwargs: Any) -> _mode error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupResourceConfigResource", pipeline_response) + deserialized = self._deserialize("BackupResourceConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -283,7 +284,7 @@ def update( :rtype: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupResourceConfigResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -317,7 +318,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -332,7 +332,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupResourceConfigResource", pipeline_response) + deserialized = self._deserialize("BackupResourceConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -340,7 +340,7 @@ def update( return deserialized # type: ignore @overload - def patch( # pylint: disable=inconsistent-return-statements + def patch( self, vault_name: str, resource_group_name: str, @@ -368,7 +368,7 @@ def patch( # pylint: disable=inconsistent-return-statements """ @overload - def patch( # pylint: disable=inconsistent-return-statements + def patch( self, vault_name: str, resource_group_name: str, @@ -418,7 +418,7 @@ def patch( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -452,7 +452,6 @@ def patch( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_usage_summaries_crr_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_usage_summaries_crr_operations.py index 1986295015ee..3df38a22db17 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_usage_summaries_crr_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_usage_summaries_crr_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -19,16 +19,18 @@ ) 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.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -128,7 +130,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BackupManagementUsageList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -149,7 +151,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -165,7 +166,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_cross_region_restore_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_cross_region_restore_operations.py index 39b92a0240d0..789fae93445d 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_cross_region_restore_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_cross_region_restore_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterator, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,12 +15,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -28,8 +29,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -87,10 +91,10 @@ def __init__(self, *args, **kwargs): 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") - def _trigger_initial( # pylint: disable=inconsistent-return-statements + def _trigger_initial( self, azure_region: str, parameters: Union[_models.CrossRegionRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -103,7 +107,7 @@ def _trigger_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -123,10 +127,10 @@ def _trigger_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -134,12 +138,20 @@ def _trigger_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_trigger( @@ -221,7 +233,7 @@ def begin_trigger( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._trigger_initial( # type: ignore + raw_result = self._trigger_initial( azure_region=azure_region, parameters=parameters, api_version=api_version, @@ -231,6 +243,7 @@ def begin_trigger( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_crr_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_crr_operation_results_operations.py index 5c1b0688fcca..5b4c52e7d238 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_crr_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_crr_operation_results_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -17,16 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -96,7 +98,7 @@ def get( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -118,7 +120,6 @@ def get( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_crr_operation_status_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_crr_operation_status_operations.py index c76f47cee47a..1b5ad9f939d0 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_crr_operation_status_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_crr_operation_status_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -17,16 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -94,7 +96,7 @@ def get(self, azure_region: str, operation_id: str, **kwargs: Any) -> _models.Op :rtype: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.OperationStatus :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -116,7 +118,6 @@ def get(self, azure_region: str, operation_id: str, **kwargs: Any) -> _models.Op headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -131,7 +132,7 @@ def get(self, azure_region: str, operation_id: str, **kwargs: Any) -> _models.Op error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("OperationStatus", pipeline_response) + deserialized = self._deserialize("OperationStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_recovery_points_crr_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_recovery_points_crr_operations.py index 72a5cb14d833..8284e339e42e 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_recovery_points_crr_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_recovery_points_crr_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -19,16 +19,18 @@ ) 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.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -179,7 +181,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RecoveryPointResourceList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -202,7 +204,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -218,7 +219,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -280,7 +280,7 @@ def get( :rtype: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.RecoveryPointResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -306,7 +306,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -321,7 +320,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecoveryPointResource", pipeline_response) + deserialized = self._deserialize("RecoveryPointResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_recovery_points_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_recovery_points_operations.py index 064d46221c8e..b2de0cfdc15d 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_recovery_points_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_recovery_points_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -18,16 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -218,12 +220,11 @@ def get_access_token( :rtype: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.CrrAccessTokenResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError, - 400: lambda response: HttpResponseError(response=response, error_format=ARMErrorFormat), } error_map.update(kwargs.pop("error_map", {}) or {}) @@ -257,7 +258,6 @@ def get_access_token( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -272,7 +272,7 @@ def get_access_token( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CrrAccessTokenResource", pipeline_response) + deserialized = self._deserialize("CrrAccessTokenResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/backup_feature_validate.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/backup_feature_validate.py index bfb198c090b1..a03dc0c6b455 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/backup_feature_validate.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/backup_feature_validate.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.recoveryservicesbackup.activestamp import RecoveryServicesBackupClient diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/configure_protection.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/configure_protection.py index 7715c2fa4c93..97f0783cd8f1 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/configure_protection.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/configure_protection.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.recoveryservicesbackup.activestamp import RecoveryServicesBackupClient diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/get_backup_status.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/get_backup_status.py index d2109172dd4c..4cd7a0e11705 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/get_backup_status.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/get_backup_status.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.recoveryservicesbackup.activestamp import RecoveryServicesBackupClient diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/protection_intent_create_or_update.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/protection_intent_create_or_update.py index d54aeadd93c0..c96df689b99a 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/protection_intent_create_or_update.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/protection_intent_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.recoveryservicesbackup.activestamp import RecoveryServicesBackupClient diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/protection_intent_validate.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/protection_intent_validate.py index 14d335618301..319401af8b0a 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/protection_intent_validate.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/protection_intent_validate.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.recoveryservicesbackup.activestamp import RecoveryServicesBackupClient diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/protection_policies_create_or_update_complex.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/protection_policies_create_or_update_complex.py index 44751e923827..06302ffc7b82 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/protection_policies_create_or_update_complex.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/protection_policies_create_or_update_complex.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.recoveryservicesbackup.activestamp import RecoveryServicesBackupClient diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/protection_policies_create_or_update_simple.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/protection_policies_create_or_update_simple.py index cc206e7a1437..d8f0d6e44a6b 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/protection_policies_create_or_update_simple.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/protection_policies_create_or_update_simple.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.recoveryservicesbackup.activestamp import RecoveryServicesBackupClient diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/provision_ilr.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/provision_ilr.py index a28d5721933d..271c446fe824 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/provision_ilr.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/provision_ilr.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.recoveryservicesbackup.activestamp import RecoveryServicesBackupClient diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/recovery_points_recommended_for_move_list.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/recovery_points_recommended_for_move_list.py index bac6221574d7..8cf8dd55616c 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/recovery_points_recommended_for_move_list.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/recovery_points_recommended_for_move_list.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.recoveryservicesbackup.activestamp import RecoveryServicesBackupClient diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/stop_protection.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/stop_protection.py index 528fc2b7866a..51b489c9c9eb 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/stop_protection.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/stop_protection.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.recoveryservicesbackup.activestamp import RecoveryServicesBackupClient diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/trigger_restore_alr_iaas_vm_restore_request.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/trigger_restore_alr_iaas_vm_restore_request.py index 88dda9f233f9..5e8d0e8a1183 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/trigger_restore_alr_iaas_vm_restore_request.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/trigger_restore_alr_iaas_vm_restore_request.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.recoveryservicesbackup.activestamp import RecoveryServicesBackupClient diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/trigger_restore_alr_iaas_vm_restore_request_identity_based_restore_details.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/trigger_restore_alr_iaas_vm_restore_request_identity_based_restore_details.py index ca8cd3a183c8..20eb947f7915 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/trigger_restore_alr_iaas_vm_restore_request_identity_based_restore_details.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/trigger_restore_alr_iaas_vm_restore_request_identity_based_restore_details.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.recoveryservicesbackup.activestamp import RecoveryServicesBackupClient diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/trigger_restore_alr_iaas_vm_restore_with_rehydration_request.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/trigger_restore_alr_iaas_vm_restore_with_rehydration_request.py index aa2f99be46d6..854059242e0f 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/trigger_restore_alr_iaas_vm_restore_with_rehydration_request.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/trigger_restore_alr_iaas_vm_restore_with_rehydration_request.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.recoveryservicesbackup.activestamp import RecoveryServicesBackupClient diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/trigger_restore_restore_disks_iaas_vm_restore_request.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/trigger_restore_restore_disks_iaas_vm_restore_request.py index 7582da964d87..c2fd4fd12ef9 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/trigger_restore_restore_disks_iaas_vm_restore_request.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/trigger_restore_restore_disks_iaas_vm_restore_request.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.recoveryservicesbackup.activestamp import RecoveryServicesBackupClient diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/trigger_restore_restore_disks_iaas_vm_restore_request_identity_based_restore_details.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/trigger_restore_restore_disks_iaas_vm_restore_request_identity_based_restore_details.py index 962ef6fa816e..4c70f971db23 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/trigger_restore_restore_disks_iaas_vm_restore_request_identity_based_restore_details.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/trigger_restore_restore_disks_iaas_vm_restore_request_identity_based_restore_details.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.recoveryservicesbackup.activestamp import RecoveryServicesBackupClient diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/trigger_restore_restore_disks_iaas_vm_restore_with_rehydration_request.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/trigger_restore_restore_disks_iaas_vm_restore_with_rehydration_request.py index 83c6013470cd..c7da11f5d99b 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/trigger_restore_restore_disks_iaas_vm_restore_with_rehydration_request.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/trigger_restore_restore_disks_iaas_vm_restore_with_rehydration_request.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.recoveryservicesbackup.activestamp import RecoveryServicesBackupClient diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/trigger_validate_operation_restore_disk.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/trigger_validate_operation_restore_disk.py index 5cadee924f7b..f6c2fe5cc2a6 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/trigger_validate_operation_restore_disk.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/trigger_validate_operation_restore_disk.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.recoveryservicesbackup.activestamp import RecoveryServicesBackupClient diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/v2_policy/iaa_s_v2_daily.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/v2_policy/iaa_s_v2_daily.py index 108571ec0bc4..ceffe5bba3c3 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/v2_policy/iaa_s_v2_daily.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/v2_policy/iaa_s_v2_daily.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.recoveryservicesbackup.activestamp import RecoveryServicesBackupClient diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/v2_policy/iaa_s_v2_hourly.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/v2_policy/iaa_s_v2_hourly.py index ce4409fe0470..b5cfc645611e 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/v2_policy/iaa_s_v2_hourly.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/v2_policy/iaa_s_v2_hourly.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.recoveryservicesbackup.activestamp import RecoveryServicesBackupClient diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/validate_operation_restore_disk.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/validate_operation_restore_disk.py index a0ca33346582..b21bfd8150bb 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/validate_operation_restore_disk.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/validate_operation_restore_disk.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.recoveryservicesbackup.activestamp import RecoveryServicesBackupClient diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/validate_operation_restore_disk_identity_based_restore_details.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/validate_operation_restore_disk_identity_based_restore_details.py index 57ee5f4ed854..9b0913ec3314 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/validate_operation_restore_disk_identity_based_restore_details.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_iaas_vm/validate_operation_restore_disk_identity_based_restore_details.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.recoveryservicesbackup.activestamp import RecoveryServicesBackupClient diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_storage/protection_containers_register.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_storage/protection_containers_register.py index a3fdfdb479b7..52fac5c602a4 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_storage/protection_containers_register.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_storage/protection_containers_register.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.recoveryservicesbackup.activestamp import RecoveryServicesBackupClient diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_storage/protection_policies_create_or_update_daily.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_storage/protection_policies_create_or_update_daily.py index 8048436175ea..8b1cb736904c 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_storage/protection_policies_create_or_update_daily.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_storage/protection_policies_create_or_update_daily.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.recoveryservicesbackup.activestamp import RecoveryServicesBackupClient diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_storage/protection_policies_create_or_update_hardened.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_storage/protection_policies_create_or_update_hardened.py index ba78c0f8fb47..34fc4855b9fe 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_storage/protection_policies_create_or_update_hardened.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_storage/protection_policies_create_or_update_hardened.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.recoveryservicesbackup.activestamp import RecoveryServicesBackupClient diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_storage/protection_policies_create_or_update_hourly.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_storage/protection_policies_create_or_update_hourly.py index afd1c098e10d..2975f9d78ac0 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_storage/protection_policies_create_or_update_hourly.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_storage/protection_policies_create_or_update_hourly.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.recoveryservicesbackup.activestamp import RecoveryServicesBackupClient diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_workload/protection_policies_create_or_update_complex.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_workload/protection_policies_create_or_update_complex.py index 960c9b656d36..e4eefd851570 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_workload/protection_policies_create_or_update_complex.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/azure_workload/protection_policies_create_or_update_complex.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.recoveryservicesbackup.activestamp import RecoveryServicesBackupClient diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/backup_data_move/prepare_data_move_post.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/backup_data_move/prepare_data_move_post.py index 3aa117c94762..04b4b08edf03 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/backup_data_move/prepare_data_move_post.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/backup_data_move/prepare_data_move_post.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.recoveryservicesbackup.activestamp import RecoveryServicesBackupClient diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/backup_data_move/trigger_data_move_post.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/backup_data_move/trigger_data_move_post.py index 14d9109a4211..260c49e16f78 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/backup_data_move/trigger_data_move_post.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/backup_data_move/trigger_data_move_post.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.recoveryservicesbackup.activestamp import RecoveryServicesBackupClient diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/backup_resource_encryption_config_put.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/backup_resource_encryption_config_put.py index b0a091dde8ba..ab1d71edf228 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/backup_resource_encryption_config_put.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/backup_resource_encryption_config_put.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.recoveryservicesbackup.activestamp import RecoveryServicesBackupClient diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/common/backup_resource_vault_configs_patch.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/common/backup_resource_vault_configs_patch.py index 0ce851f5fbf5..30bd99e86ff3 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/common/backup_resource_vault_configs_patch.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/common/backup_resource_vault_configs_patch.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.recoveryservicesbackup.activestamp import RecoveryServicesBackupClient diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/common/backup_resource_vault_configs_put.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/common/backup_resource_vault_configs_put.py index 08b686474948..7340ab843338 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/common/backup_resource_vault_configs_put.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/common/backup_resource_vault_configs_put.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.recoveryservicesbackup.activestamp import RecoveryServicesBackupClient diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/common/backup_storage_config_patch.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/common/backup_storage_config_patch.py index 78bf61a71967..06a18f852a5b 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/common/backup_storage_config_patch.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/common/backup_storage_config_patch.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.recoveryservicesbackup.activestamp import RecoveryServicesBackupClient diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/common/backup_storage_config_put.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/common/backup_storage_config_put.py index 866c860921f4..d6e5b4149f5e 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/common/backup_storage_config_put.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/common/backup_storage_config_put.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.recoveryservicesbackup.activestamp import RecoveryServicesBackupClient diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/common/trigger_backup_post.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/common/trigger_backup_post.py index 29662173150c..dcfffcf67c70 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/common/trigger_backup_post.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/common/trigger_backup_post.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.recoveryservicesbackup.activestamp import RecoveryServicesBackupClient diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/private_endpoint_connection/put_private_endpoint_connection.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/private_endpoint_connection/put_private_endpoint_connection.py index 8dbe45134b24..3924b3f52d8f 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/private_endpoint_connection/put_private_endpoint_connection.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/private_endpoint_connection/put_private_endpoint_connection.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.recoveryservicesbackup.activestamp import RecoveryServicesBackupClient diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/resource_guard_proxy_crud/put_resource_guard_proxy.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/resource_guard_proxy_crud/put_resource_guard_proxy.py index cd16b70061e1..92cbbf2343df 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/resource_guard_proxy_crud/put_resource_guard_proxy.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/resource_guard_proxy_crud/put_resource_guard_proxy.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.recoveryservicesbackup.activestamp import RecoveryServicesBackupClient diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/resource_guard_proxy_crud/unlock_delete_resource_guard_proxy.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/resource_guard_proxy_crud/unlock_delete_resource_guard_proxy.py index a7a2fce82c34..165095e38efe 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/resource_guard_proxy_crud/unlock_delete_resource_guard_proxy.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/resource_guard_proxy_crud/unlock_delete_resource_guard_proxy.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.recoveryservicesbackup.activestamp import RecoveryServicesBackupClient diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/tiering_cost/fetch_tiering_cost_for_policy.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/tiering_cost/fetch_tiering_cost_for_policy.py index fb5c462a6cbb..78496cc8d800 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/tiering_cost/fetch_tiering_cost_for_policy.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/tiering_cost/fetch_tiering_cost_for_policy.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.recoveryservicesbackup.activestamp import RecoveryServicesBackupClient diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/tiering_cost/fetch_tiering_cost_for_protected_item.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/tiering_cost/fetch_tiering_cost_for_protected_item.py index 4b925ee3da5d..b1c0fbb3ba6b 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/tiering_cost/fetch_tiering_cost_for_protected_item.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/tiering_cost/fetch_tiering_cost_for_protected_item.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.recoveryservicesbackup.activestamp import RecoveryServicesBackupClient diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/tiering_cost/fetch_tiering_cost_for_rehydrate.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/tiering_cost/fetch_tiering_cost_for_rehydrate.py index 72a614aa2de8..84df9d25ef60 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/tiering_cost/fetch_tiering_cost_for_rehydrate.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/tiering_cost/fetch_tiering_cost_for_rehydrate.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.recoveryservicesbackup.activestamp import RecoveryServicesBackupClient diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/tiering_cost/fetch_tiering_cost_for_vault.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/tiering_cost/fetch_tiering_cost_for_vault.py index 3f093d0501f7..6bf0bfe5a3c8 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/tiering_cost/fetch_tiering_cost_for_vault.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/tiering_cost/fetch_tiering_cost_for_vault.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.recoveryservicesbackup.activestamp import RecoveryServicesBackupClient diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/trigger_recovery_point_move_post.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/trigger_recovery_point_move_post.py index 1b38ec86e173..4c713f66164c 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/trigger_recovery_point_move_post.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/activestamp/trigger_recovery_point_move_post.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.recoveryservicesbackup.activestamp import RecoveryServicesBackupClient diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/passivestamp/azure_iaas_vm/get_access_token_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/passivestamp/azure_iaas_vm/get_access_token_get.py index 3271881fbc2d..dd746880d4f5 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/passivestamp/azure_iaas_vm/get_access_token_get.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/passivestamp/azure_iaas_vm/get_access_token_get.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.recoveryservicesbackup.passivestamp import RecoveryServicesBackupPassiveClient diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/passivestamp/azure_iaas_vm/get_crr_job_post.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/passivestamp/azure_iaas_vm/get_crr_job_post.py index 7763749648ce..0c9140f70e9b 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/passivestamp/azure_iaas_vm/get_crr_job_post.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/passivestamp/azure_iaas_vm/get_crr_job_post.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.recoveryservicesbackup.passivestamp import RecoveryServicesBackupPassiveClient diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/passivestamp/azure_iaas_vm/list_crr_jobs_post.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/passivestamp/azure_iaas_vm/list_crr_jobs_post.py index beccd76f8dee..fe2d110b6f13 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/passivestamp/azure_iaas_vm/list_crr_jobs_post.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/passivestamp/azure_iaas_vm/list_crr_jobs_post.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.recoveryservicesbackup.passivestamp import RecoveryServicesBackupPassiveClient diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/passivestamp/azure_iaas_vm/trigger_cross_region_restore_identity_based_restore_details_post.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/passivestamp/azure_iaas_vm/trigger_cross_region_restore_identity_based_restore_details_post.py new file mode 100644 index 000000000000..dfd2418e2462 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/passivestamp/azure_iaas_vm/trigger_cross_region_restore_identity_based_restore_details_post.py @@ -0,0 +1,87 @@ +# 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.identity import DefaultAzureCredential + +from azure.mgmt.recoveryservicesbackup.passivestamp import RecoveryServicesBackupPassiveClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python trigger_cross_region_restore_identity_based_restore_details_post.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupPassiveClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.cross_region_restore.begin_trigger( + azure_region="southeastasia", + parameters={ + "crossRegionRestoreAccessDetails": { + "accessTokenString": "**********", + "backupManagementType": "AzureIaasVM", + "containerName": "iaasvmcontainerv2;srinivasccyrg;sriniccylinux", + "containerType": "IaasVMContainer", + "coordinatorServiceStampUri": "https://pod01-coord1.ccy.backup.windowsazure.com", + "datasourceContainerName": "iaasvmcontainerv2;srinivasccyrg;sriniccylinux", + "datasourceId": "1142937031", + "datasourceName": "sriniccylinux", + "datasourceType": "VM", + "objectType": "WorkloadCrrAccessToken", + "protectionServiceStampId": "90d98224-2ac6-4bda-9f35-33fb22841f2a", + "protectionServiceStampUri": "https://pod01-prot1-int.ccy.backup.windowsazure.com", + "recoveryPointId": "87178355392716", + "recoveryPointTime": "10/9/2019 6:05:54 PM", + "resourceGroupName": "srinivasccyrg", + "resourceId": "1330837906418138160", + "resourceName": "sriniccyvault", + "subscriptionId": "f2edfd5d-5496-4683-b94f-b3588c579009", + "tokenExtendedInformation": 'V2015_09f2edfd5d-5496-4683-b94f-b3588c579009;AzureBackup_sriniccylinux_1142937031;AzureBackup_20191009_060554;AzureBackupRG_centraluseuap_1truetruefalseLinuxFileSystemConsistentPremiumVMOnPremiumStorageStandard_D2s_v3', + }, + "restoreRequest": { + "affinityGroup": "", + "createNewCloudService": False, + "encryptionDetails": {"encryptionEnabled": False}, + "identityBasedRestoreDetails": { + "targetStorageAccountId": "/subscriptions/f2edfd5d-5496-4683-b94f-b3588c579009/resourceGroups/00prjaiTestRg1/providers/Microsoft.Storage/storageAccounts/00prjaitestrg1disks993" + }, + "identityInfo": { + "isSystemAssignedIdentity": False, + "managedIdentityResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/asmaskarRG1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/asmaskartestmsi", + }, + "objectType": "IaasVMRestoreRequest", + "originalStorageAccountOption": False, + "recoveryPointId": "87178355392716", + "recoveryType": "AlternateLocation", + "region": "eastus2euap", + "sourceResourceId": "/subscriptions/f2edfd5d-5496-4683-b94f-b3588c579009/resourceGroups/srinivasccyrg/providers/Microsoft.Compute/virtualMachines/sriniccylinux", + "subnetId": "/subscriptions/f2edfd5d-5496-4683-b94f-b3588c579009/resourceGroups/00networkAcklVaultCCY/providers/Microsoft.Network/virtualNetworks/00networkAcklVaultCCY-vnet/subnets/default", + "targetDomainNameId": None, + "targetResourceGroupId": "/subscriptions/f2edfd5d-5496-4683-b94f-b3588c579009/resourceGroups/00networkAckl", + "targetVirtualMachineId": "/subscriptions/f2edfd5d-5496-4683-b94f-b3588c579009/resourceGroups/00networkAckl/providers/Microsoft.Compute/virtualMachines/gaallaVM", + "virtualNetworkId": "/subscriptions/f2edfd5d-5496-4683-b94f-b3588c579009/resourceGroups/00networkAcklVaultCCY/providers/Microsoft.Network/virtualNetworks/00networkAcklVaultCCY-vnet", + "zones": ["2"], + }, + }, + ).result() + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2021-11-15/examples/AzureIaasVm/TriggerCrossRegionRestore_IdentityBasedRestoreDetails_Post.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/passivestamp/azure_iaas_vm/trigger_cross_region_restore_post.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/passivestamp/azure_iaas_vm/trigger_cross_region_restore_post.py new file mode 100644 index 000000000000..ee62856b2db4 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/passivestamp/azure_iaas_vm/trigger_cross_region_restore_post.py @@ -0,0 +1,85 @@ +# 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.identity import DefaultAzureCredential + +from azure.mgmt.recoveryservicesbackup.passivestamp import RecoveryServicesBackupPassiveClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python trigger_cross_region_restore_post.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupPassiveClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.cross_region_restore.begin_trigger( + azure_region="southeastasia", + parameters={ + "crossRegionRestoreAccessDetails": { + "accessTokenString": "**********", + "backupManagementType": "AzureIaasVM", + "containerName": "iaasvmcontainerv2;srinivasccyrg;sriniccylinux", + "containerType": "IaasVMContainer", + "coordinatorServiceStampUri": "https://pod01-coord1.ccy.backup.windowsazure.com", + "datasourceContainerName": "iaasvmcontainerv2;srinivasccyrg;sriniccylinux", + "datasourceId": "1142937031", + "datasourceName": "sriniccylinux", + "datasourceType": "VM", + "objectType": "WorkloadCrrAccessToken", + "protectionServiceStampId": "90d98224-2ac6-4bda-9f35-33fb22841f2a", + "protectionServiceStampUri": "https://pod01-prot1-int.ccy.backup.windowsazure.com", + "recoveryPointId": "87178355392716", + "recoveryPointTime": "10/9/2019 6:05:54 PM", + "resourceGroupName": "srinivasccyrg", + "resourceId": "1330837906418138160", + "resourceName": "sriniccyvault", + "subscriptionId": "f2edfd5d-5496-4683-b94f-b3588c579009", + "tokenExtendedInformation": 'V2015_09f2edfd5d-5496-4683-b94f-b3588c579009;AzureBackup_sriniccylinux_1142937031;AzureBackup_20191009_060554;AzureBackupRG_centraluseuap_1truetruefalseLinuxFileSystemConsistentPremiumVMOnPremiumStorageStandard_D2s_v3', + }, + "restoreRequest": { + "affinityGroup": "", + "createNewCloudService": False, + "encryptionDetails": {"encryptionEnabled": False}, + "identityInfo": { + "isSystemAssignedIdentity": False, + "managedIdentityResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/asmaskarRG1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/asmaskartestmsi", + }, + "objectType": "IaasVMRestoreRequest", + "originalStorageAccountOption": False, + "recoveryPointId": "87178355392716", + "recoveryType": "AlternateLocation", + "region": "eastus2euap", + "sourceResourceId": "/subscriptions/f2edfd5d-5496-4683-b94f-b3588c579009/resourceGroups/srinivasccyrg/providers/Microsoft.Compute/virtualMachines/sriniccylinux", + "storageAccountId": "/subscriptions/f2edfd5d-5496-4683-b94f-b3588c579009/resourceGroups/00prjaiTestRg1/providers/Microsoft.Storage/storageAccounts/00prjaitestrg1disks993", + "subnetId": "/subscriptions/f2edfd5d-5496-4683-b94f-b3588c579009/resourceGroups/00networkAcklVaultCCY/providers/Microsoft.Network/virtualNetworks/00networkAcklVaultCCY-vnet/subnets/default", + "targetDomainNameId": None, + "targetResourceGroupId": "/subscriptions/f2edfd5d-5496-4683-b94f-b3588c579009/resourceGroups/00networkAckl", + "targetVirtualMachineId": "/subscriptions/f2edfd5d-5496-4683-b94f-b3588c579009/resourceGroups/00networkAckl/providers/Microsoft.Compute/virtualMachines/gaallaVM", + "virtualNetworkId": "/subscriptions/f2edfd5d-5496-4683-b94f-b3588c579009/resourceGroups/00networkAcklVaultCCY/providers/Microsoft.Network/virtualNetworks/00networkAcklVaultCCY-vnet", + "zones": ["2"], + }, + }, + ).result() + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2021-11-15/examples/AzureIaasVm/TriggerCrossRegionRestore_Post.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/passivestamp/common/backup_storage_config_patch.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/passivestamp/common/backup_storage_config_patch.py index 62d997c72c19..60cf72b2196d 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/passivestamp/common/backup_storage_config_patch.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/passivestamp/common/backup_storage_config_patch.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.recoveryservicesbackup.passivestamp import RecoveryServicesBackupPassiveClient diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/passivestamp/common/backup_storage_config_put.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/passivestamp/common/backup_storage_config_put.py index 8c4362e33ac8..94d3bc334baf 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/passivestamp/common/backup_storage_config_put.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/passivestamp/common/backup_storage_config_put.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.recoveryservicesbackup.passivestamp import RecoveryServicesBackupPassiveClient diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/setup.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/setup.py index 822c72ba578a..6ba4051dae01 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/setup.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/setup.py @@ -75,6 +75,7 @@ }, install_requires=[ "isodate>=0.6.1", + "typing-extensions>=4.6.0", "azure-common>=1.1", "azure-mgmt-core>=1.3.2", ],