From ebaa48fcd404518131c814925ccbf53d7d02ea95 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 2 Apr 2025 17:24:34 +0000 Subject: [PATCH] CodeGen from PR 33662 in Azure/azure-rest-api-specs Merge 41b031155a3fc270bfa0cf5bc4f3e56f350d2e30 into fb5c8fa550e9dd280236a93a974a2262000ab0b6 --- .../azure-mgmt-dataprotection/CHANGELOG.md | 16 + .../azure-mgmt-dataprotection/README.md | 2 +- .../azure-mgmt-dataprotection/_meta.json | 6 +- .../azure/mgmt/dataprotection/__init__.py | 12 +- .../mgmt/dataprotection/_configuration.py | 7 +- .../_data_protection_mgmt_client.py | 8 +- .../mgmt/dataprotection/_serialization.py | 436 +++++++----- .../azure/mgmt/dataprotection/_vendor.py | 16 - .../azure/mgmt/dataprotection/_version.py | 2 +- .../azure/mgmt/dataprotection/aio/__init__.py | 12 +- .../mgmt/dataprotection/aio/_configuration.py | 7 +- .../aio/_data_protection_mgmt_client.py | 8 +- .../dataprotection/aio/operations/__init__.py | 54 +- ..._instances_extension_routing_operations.py | 13 +- .../_backup_instances_operations.py | 573 ++++++++++++---- .../operations/_backup_policies_operations.py | 30 +- ...ckup_vault_operation_results_operations.py | 14 +- .../operations/_backup_vaults_operations.py | 98 +-- .../operations/_data_protection_operations.py | 14 +- .../_data_protection_operations_operations.py | 13 +- .../_deleted_backup_instances_operations.py | 45 +- .../_dpp_resource_guard_proxy_operations.py | 33 +- ...export_jobs_operation_result_operations.py | 14 +- .../aio/operations/_export_jobs_operations.py | 36 +- ...tch_cross_region_restore_job_operations.py | 14 +- ...ch_cross_region_restore_jobs_operations.py | 13 +- ...ch_secondary_recovery_points_operations.py | 13 +- .../aio/operations/_jobs_operations.py | 18 +- .../_operation_result_operations.py | 14 +- ..._status_backup_vault_context_operations.py | 14 +- .../_operation_status_operations.py | 14 +- ...tatus_resource_group_context_operations.py | 14 +- .../operations/_recovery_points_operations.py | 18 +- .../operations/_resource_guards_operations.py | 98 +-- .../_restorable_time_ranges_operations.py | 16 +- .../mgmt/dataprotection/models/__init__.py | 425 ++++++------ .../_data_protection_mgmt_client_enums.py | 8 +- .../mgmt/dataprotection/models/_models_py3.py | 235 ++++--- .../dataprotection/operations/__init__.py | 54 +- ..._instances_extension_routing_operations.py | 15 +- .../_backup_instances_operations.py | 645 +++++++++++++----- .../operations/_backup_policies_operations.py | 34 +- ...ckup_vault_operation_results_operations.py | 16 +- .../operations/_backup_vaults_operations.py | 113 +-- .../operations/_data_protection_operations.py | 16 +- .../_data_protection_operations_operations.py | 15 +- .../_deleted_backup_instances_operations.py | 51 +- .../_dpp_resource_guard_proxy_operations.py | 41 +- ...export_jobs_operation_result_operations.py | 16 +- .../operations/_export_jobs_operations.py | 38 +- ...tch_cross_region_restore_job_operations.py | 16 +- ...ch_cross_region_restore_jobs_operations.py | 15 +- ...ch_secondary_recovery_points_operations.py | 15 +- .../operations/_jobs_operations.py | 22 +- .../_operation_result_operations.py | 16 +- ..._status_backup_vault_context_operations.py | 16 +- .../_operation_status_operations.py | 16 +- ...tatus_resource_group_context_operations.py | 16 +- .../operations/_recovery_points_operations.py | 22 +- .../operations/_resource_guards_operations.py | 130 ++-- .../_restorable_time_ranges_operations.py | 18 +- .../delete_backup_instance.py | 2 +- .../find_restorable_time_ranges.py | 4 +- .../get_backup_instance.py | 2 +- ...e_adlsblob_backup_datasource_parameters.py | 43 ++ .../get_backup_instance_operation_result.py | 2 +- .../get_recovery_point.py | 2 +- .../list_backup_instances.py | 2 +- ...list_backup_instances_extension_routing.py | 2 +- .../list_recovery_points.py | 2 +- .../put_backup_instance.py | 4 +- ...e_adlsblob_backup_datasource_parameters.py | 76 +++ ...es_cluster_backup_datasource_parameters.py | 93 +++ ..._backup_instance_resource_guard_enabled.py | 4 +- .../resume_backups.py | 2 +- .../resume_protection.py | 2 +- .../stop_protection.py | 2 +- .../stop_protection_resource_guard_enabled.py | 2 +- .../suspend_backup_resource_guard_enabled.py | 2 +- .../suspend_backups.py | 2 +- .../sync_backup_instance.py | 4 +- .../trigger_backup.py | 4 +- .../trigger_rehydrate.py | 4 +- .../trigger_restore.py | 4 +- .../trigger_restore_as_files.py | 4 +- .../trigger_restore_with_rehydration.py | 4 +- .../validate_for_backup.py | 4 +- .../validate_for_modify_backup.py | 76 +++ .../validate_restore.py | 4 +- .../generated_samples/checkfeature_support.py | 4 +- .../fetch_cross_region_restore_job.py | 4 +- .../fetch_cross_region_restore_jobs.py | 4 +- .../fetch_secondary_rps.py | 4 +- .../trigger_cross_region_restore.py | 4 +- .../validate_cross_region_restore.py | 4 +- .../get_deleted_backup_instance.py | 2 +- .../list_deleted_backup_instances.py | 2 +- .../undelete_deleted_backup_instance.py | 2 +- .../generated_samples/get_operation_result.py | 2 +- .../generated_samples/get_operation_status.py | 2 +- .../get_operation_status_rg_context.py | 2 +- .../get_operation_status_vault_context.py | 2 +- .../get_export_jobs_operation_result.py | 2 +- .../generated_samples/job_crud/get_job.py | 2 +- .../generated_samples/job_crud/list_jobs.py | 2 +- .../job_crud/trigger_export_jobs.py | 2 +- .../generated_samples/operations/list.py | 2 +- .../create_or_update_backup_policy.py | 4 +- .../policy_crud/delete_backup_policy.py | 2 +- .../policy_crud/get_backup_policy.py | 2 +- .../policy_crud/list_backup_policy.py | 2 +- .../delete_resource_guard.py | 2 +- ...et_default_backup_security_pin_requests.py | 2 +- ..._default_delete_protected_item_requests.py | 2 +- ...lt_delete_resource_guard_proxy_requests.py | 2 +- ...et_default_disable_soft_delete_requests.py | 2 +- ..._default_update_protected_item_requests.py | 2 +- ...fault_update_protection_policy_requests.py | 2 +- .../resource_guard_crud/get_resource_guard.py | 2 +- .../get_resource_guards_in_resource_group.py | 2 +- .../get_resource_guards_in_subscription.py | 2 +- .../list_backup_security_pin_requests.py | 2 +- .../list_delete_protected_item_requests.py | 2 +- ...st_delete_resource_guard_proxy_requests.py | 2 +- .../list_disable_soft_delete_requests.py | 2 +- .../list_update_protected_item_requests.py | 2 +- .../list_update_protection_policy_requests.py | 2 +- .../patch_resource_guard.py | 4 +- .../resource_guard_crud/put_resource_guard.py | 4 +- .../delete_resource_guard_proxy.py | 2 +- .../get_resource_guard_proxy.py | 2 +- .../list_resource_guard_proxy.py | 2 +- .../put_resource_guard_proxy.py | 4 +- .../unlock_delete_resource_guard_proxy.py | 4 +- .../check_backup_vaults_name_availability.py | 4 +- .../vault_crud/delete_backup_vault.py | 2 +- .../vault_crud/get_backup_vault.py | 2 +- .../vault_crud/get_backup_vault_with_cmk.py | 2 +- .../vault_crud/get_backup_vault_with_msi.py | 2 +- .../get_backup_vaults_in_resource_group.py | 2 +- .../get_backup_vaults_in_subscription.py | 2 +- .../vault_crud/get_operation_result_patch.py | 2 +- .../vault_crud/patch_backup_vault.py | 4 +- .../vault_crud/patch_backup_vault_with_cmk.py | 4 +- .../vault_crud/put_backup_vault.py | 4 +- .../vault_crud/put_backup_vault_with_cmk.py | 4 +- .../vault_crud/put_backup_vault_with_msi.py | 4 +- .../generated_tests/conftest.py | 35 + ..._instances_extension_routing_operations.py | 30 + ...nces_extension_routing_operations_async.py | 31 + ...ection_mgmt_backup_instances_operations.py | 480 +++++++++++++ ..._mgmt_backup_instances_operations_async.py | 527 ++++++++++++++ ...tection_mgmt_backup_policies_operations.py | 84 +++ ...n_mgmt_backup_policies_operations_async.py | 85 +++ ...ckup_vault_operation_results_operations.py | 32 + ...ault_operation_results_operations_async.py | 33 + ...rotection_mgmt_backup_vaults_operations.py | 182 +++++ ...ion_mgmt_backup_vaults_operations_async.py | 189 +++++ ...tection_mgmt_data_protection_operations.py | 31 + ...n_mgmt_data_protection_operations_async.py | 32 + ...t_data_protection_operations_operations.py | 29 + ..._protection_operations_operations_async.py | 30 + ...gmt_deleted_backup_instances_operations.py | 57 ++ ...leted_backup_instances_operations_async.py | 60 ++ ...gmt_dpp_resource_guard_proxy_operations.py | 105 +++ ...p_resource_guard_proxy_operations_async.py | 106 +++ ...export_jobs_operation_result_operations.py | 32 + ..._jobs_operation_result_operations_async.py | 33 + ..._protection_mgmt_export_jobs_operations.py | 31 + ...ction_mgmt_export_jobs_operations_async.py | 34 + ...tch_cross_region_restore_job_operations.py | 32 + ...oss_region_restore_job_operations_async.py | 33 + ...ch_cross_region_restore_jobs_operations.py | 32 + ...ss_region_restore_jobs_operations_async.py | 33 + ...ch_secondary_recovery_points_operations.py | 32 + ...ondary_recovery_points_operations_async.py | 33 + ...st_data_protection_mgmt_jobs_operations.py | 44 ++ ...a_protection_mgmt_jobs_operations_async.py | 45 ++ ...ection_mgmt_operation_result_operations.py | 31 + ..._mgmt_operation_result_operations_async.py | 32 + ..._status_backup_vault_context_operations.py | 32 + ...s_backup_vault_context_operations_async.py | 33 + ...ection_mgmt_operation_status_operations.py | 31 + ..._mgmt_operation_status_operations_async.py | 32 + ...tatus_resource_group_context_operations.py | 31 + ...resource_group_context_operations_async.py | 32 + ...tection_mgmt_recovery_points_operations.py | 46 ++ ...n_mgmt_recovery_points_operations_async.py | 47 ++ ...tection_mgmt_resource_guards_operations.py | 262 +++++++ ...n_mgmt_resource_guards_operations_async.py | 263 +++++++ ..._mgmt_restorable_time_ranges_operations.py | 33 + ...restorable_time_ranges_operations_async.py | 34 + .../azure-mgmt-dataprotection/setup.py | 1 + 193 files changed, 6071 insertions(+), 1688 deletions(-) delete mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_vendor.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/get_backup_instance_adlsblob_backup_datasource_parameters.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/put_backup_instance_adlsblob_backup_datasource_parameters.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/put_backup_instance_kubernetes_cluster_backup_datasource_parameters.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/validate_for_modify_backup.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/conftest.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_backup_instances_extension_routing_operations.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_backup_instances_extension_routing_operations_async.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_backup_instances_operations.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_backup_instances_operations_async.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_backup_policies_operations.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_backup_policies_operations_async.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_backup_vault_operation_results_operations.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_backup_vault_operation_results_operations_async.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_backup_vaults_operations.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_backup_vaults_operations_async.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_data_protection_operations.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_data_protection_operations_async.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_data_protection_operations_operations.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_data_protection_operations_operations_async.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_deleted_backup_instances_operations.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_deleted_backup_instances_operations_async.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_dpp_resource_guard_proxy_operations.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_dpp_resource_guard_proxy_operations_async.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_export_jobs_operation_result_operations.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_export_jobs_operation_result_operations_async.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_export_jobs_operations.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_export_jobs_operations_async.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_fetch_cross_region_restore_job_operations.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_fetch_cross_region_restore_job_operations_async.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_fetch_cross_region_restore_jobs_operations.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_fetch_cross_region_restore_jobs_operations_async.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_fetch_secondary_recovery_points_operations.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_fetch_secondary_recovery_points_operations_async.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_jobs_operations.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_jobs_operations_async.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_operation_result_operations.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_operation_result_operations_async.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_operation_status_backup_vault_context_operations.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_operation_status_backup_vault_context_operations_async.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_operation_status_operations.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_operation_status_operations_async.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_operation_status_resource_group_context_operations.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_operation_status_resource_group_context_operations_async.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_recovery_points_operations.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_recovery_points_operations_async.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_resource_guards_operations.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_resource_guards_operations_async.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_restorable_time_ranges_operations.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_restorable_time_ranges_operations_async.py diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/CHANGELOG.md b/sdk/dataprotection/azure-mgmt-dataprotection/CHANGELOG.md index 0d87512a7f76..0daab24f7cfb 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/CHANGELOG.md +++ b/sdk/dataprotection/azure-mgmt-dataprotection/CHANGELOG.md @@ -1,5 +1,21 @@ # Release History +## 2.0.0 (2025-04-02) + +### Features Added + + - Model `KubernetesClusterBackupDatasourceParameters` added property `included_volume_types` + - Added enum `AKSVolumeTypes` + - Added model `AdlsBlobBackupDatasourceParameters` + - Added model `ValidateForModifyBackupRequest` + - Model `BackupInstancesOperations` added method `begin_validate_for_modify_backup` + - Method `BackupInstancesOperations.begin_validate_for_modify_backup` has a new overload `def begin_validate_for_modify_backup(self: None, resource_group_name: str, vault_name: str, backup_instance_name: str, parameters: ValidateForModifyBackupRequest, content_type: str)` + - Method `BackupInstancesOperations.begin_validate_for_modify_backup` has a new overload `def begin_validate_for_modify_backup(self: None, resource_group_name: str, vault_name: str, backup_instance_name: str, parameters: IO[bytes], content_type: str)` + +### Breaking Changes + + - Deleted or renamed enum value `RestoreSourceDataStoreType.VAULT_STORE` + ## 1.4.0 (2024-07-22) ### Features Added diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/README.md b/sdk/dataprotection/azure-mgmt-dataprotection/README.md index c874cebbaa51..0a2a6d3aeb02 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/README.md +++ b/sdk/dataprotection/azure-mgmt-dataprotection/README.md @@ -24,7 +24,7 @@ pip install azure-identity ### Authentication -By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables. +By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configuration of the following environment variables. - `AZURE_CLIENT_ID` for Azure client ID. - `AZURE_TENANT_ID` for Azure tenant ID. diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/_meta.json b/sdk/dataprotection/azure-mgmt-dataprotection/_meta.json index 44df65fcbeb8..d50997764565 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/_meta.json +++ b/sdk/dataprotection/azure-mgmt-dataprotection/_meta.json @@ -1,11 +1,11 @@ { - "commit": "7bf13ef1c776f6d973b9645906281d0ec4660fc8", + "commit": "0974bad79af2c1938e42404cae1f95e700acde69", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.10.2", "use": [ - "@autorest/python@6.13.19", + "@autorest/python@6.27.4", "@autorest/modelerfour@4.27.0" ], - "autorest_command": "autorest specification/dataprotection/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.19 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", + "autorest_command": "autorest specification/dataprotection/resource-manager/readme.md --generate-sample=True --generate-test=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.4 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", "readme": "specification/dataprotection/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/__init__.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/__init__.py index b8f7d1ce0164..5cf805aaeb4f 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/__init__.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/__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 ._data_protection_mgmt_client import DataProtectionMgmtClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._data_protection_mgmt_client import DataProtectionMgmtClient # 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__ = [ "DataProtectionMgmtClient", ] -__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/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_configuration.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_configuration.py index cbd666b18f43..7f57fb7c20fc 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_configuration.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_configuration.py @@ -14,11 +14,10 @@ from ._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class DataProtectionMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class DataProtectionMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for DataProtectionMgmtClient. Note that all parameters used to create this instance are saved as instance @@ -28,13 +27,13 @@ class DataProtectionMgmtClientConfiguration: # pylint: disable=too-many-instanc :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2024-04-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2025-02-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2024-04-01") + api_version: str = kwargs.pop("api_version", "2025-02-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_data_protection_mgmt_client.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_data_protection_mgmt_client.py index 78bed82f0b26..6f78687fdf2d 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_data_protection_mgmt_client.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_data_protection_mgmt_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 @@ -43,11 +44,10 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class DataProtectionMgmtClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class DataProtectionMgmtClient: # pylint: disable=too-many-instance-attributes """Open API 2.0 Specs for Azure Data Protection service. :ivar backup_vaults: BackupVaultsOperations operations @@ -114,7 +114,7 @@ class DataProtectionMgmtClient: # pylint: disable=client-accepts-api-version-ke :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2024-04-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2025-02-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no @@ -233,7 +233,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "DataProtectionMgmtClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_serialization.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_serialization.py index f0c6180722c8..b24ab2885450 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_serialization.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_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 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/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_vendor.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_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/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_version.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_version.py index b97926d4bc86..48944bf3938a 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_version.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.4.0" +VERSION = "2.0.0" diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/__init__.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/__init__.py index b1b173bd7e27..e167d09eadef 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/__init__.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/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 ._data_protection_mgmt_client import DataProtectionMgmtClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._data_protection_mgmt_client import DataProtectionMgmtClient # 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__ = [ "DataProtectionMgmtClient", ] -__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/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/_configuration.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/_configuration.py index 4809b5ab60c7..f7746a013853 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/_configuration.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/_configuration.py @@ -14,11 +14,10 @@ from .._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class DataProtectionMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class DataProtectionMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for DataProtectionMgmtClient. Note that all parameters used to create this instance are saved as instance @@ -28,13 +27,13 @@ class DataProtectionMgmtClientConfiguration: # pylint: disable=too-many-instanc :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2024-04-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2025-02-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2024-04-01") + api_version: str = kwargs.pop("api_version", "2025-02-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/_data_protection_mgmt_client.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/_data_protection_mgmt_client.py index bc03bbf9f6da..fc7383d500ab 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/_data_protection_mgmt_client.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/_data_protection_mgmt_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 @@ -43,11 +44,10 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class DataProtectionMgmtClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class DataProtectionMgmtClient: # pylint: disable=too-many-instance-attributes """Open API 2.0 Specs for Azure Data Protection service. :ivar backup_vaults: BackupVaultsOperations operations @@ -114,7 +114,7 @@ class DataProtectionMgmtClient: # pylint: disable=client-accepts-api-version-ke :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2024-04-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2025-02-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no @@ -235,7 +235,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "DataProtectionMgmtClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/__init__.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/__init__.py index 42904f5f3feb..7e3278153c5e 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/__init__.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/__init__.py @@ -5,32 +5,38 @@ # 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_vaults_operations import BackupVaultsOperations -from ._operation_result_operations import OperationResultOperations -from ._operation_status_operations import OperationStatusOperations -from ._operation_status_backup_vault_context_operations import OperationStatusBackupVaultContextOperations -from ._operation_status_resource_group_context_operations import OperationStatusResourceGroupContextOperations -from ._backup_vault_operation_results_operations import BackupVaultOperationResultsOperations -from ._data_protection_operations import DataProtectionOperations -from ._data_protection_operations_operations import DataProtectionOperationsOperations -from ._backup_policies_operations import BackupPoliciesOperations -from ._backup_instances_operations import BackupInstancesOperations -from ._recovery_points_operations import RecoveryPointsOperations -from ._fetch_secondary_recovery_points_operations import FetchSecondaryRecoveryPointsOperations -from ._fetch_cross_region_restore_job_operations import FetchCrossRegionRestoreJobOperations -from ._fetch_cross_region_restore_jobs_operations import FetchCrossRegionRestoreJobsOperations -from ._backup_instances_extension_routing_operations import BackupInstancesExtensionRoutingOperations -from ._jobs_operations import JobsOperations -from ._restorable_time_ranges_operations import RestorableTimeRangesOperations -from ._export_jobs_operations import ExportJobsOperations -from ._export_jobs_operation_result_operations import ExportJobsOperationResultOperations -from ._deleted_backup_instances_operations import DeletedBackupInstancesOperations -from ._resource_guards_operations import ResourceGuardsOperations -from ._dpp_resource_guard_proxy_operations import DppResourceGuardProxyOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._backup_vaults_operations import BackupVaultsOperations # type: ignore +from ._operation_result_operations import OperationResultOperations # type: ignore +from ._operation_status_operations import OperationStatusOperations # type: ignore +from ._operation_status_backup_vault_context_operations import OperationStatusBackupVaultContextOperations # type: ignore +from ._operation_status_resource_group_context_operations import OperationStatusResourceGroupContextOperations # type: ignore +from ._backup_vault_operation_results_operations import BackupVaultOperationResultsOperations # type: ignore +from ._data_protection_operations import DataProtectionOperations # type: ignore +from ._data_protection_operations_operations import DataProtectionOperationsOperations # type: ignore +from ._backup_policies_operations import BackupPoliciesOperations # type: ignore +from ._backup_instances_operations import BackupInstancesOperations # type: ignore +from ._recovery_points_operations import RecoveryPointsOperations # type: ignore +from ._fetch_secondary_recovery_points_operations import FetchSecondaryRecoveryPointsOperations # type: ignore +from ._fetch_cross_region_restore_job_operations import FetchCrossRegionRestoreJobOperations # type: ignore +from ._fetch_cross_region_restore_jobs_operations import FetchCrossRegionRestoreJobsOperations # type: ignore +from ._backup_instances_extension_routing_operations import BackupInstancesExtensionRoutingOperations # type: ignore +from ._jobs_operations import JobsOperations # type: ignore +from ._restorable_time_ranges_operations import RestorableTimeRangesOperations # type: ignore +from ._export_jobs_operations import ExportJobsOperations # type: ignore +from ._export_jobs_operation_result_operations import ExportJobsOperationResultOperations # type: ignore +from ._deleted_backup_instances_operations import DeletedBackupInstancesOperations # type: ignore +from ._resource_guards_operations import ResourceGuardsOperations # type: ignore +from ._dpp_resource_guard_proxy_operations import DppResourceGuardProxyOperations # 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__ = [ @@ -57,5 +63,5 @@ "ResourceGuardsOperations", "DppResourceGuardProxyOperations", ] -__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/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_instances_extension_routing_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_instances_extension_routing_operations.py index 6f907f4bc8a5..bd897e3b28d8 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_instances_extension_routing_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_instances_extension_routing_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,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +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_instances_extension_routing_operations import build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +73,7 @@ def list(self, resource_id: str, **kwargs: Any) -> AsyncIterable["_models.Backup api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BackupInstanceResourceList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -93,7 +90,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -109,7 +105,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/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_instances_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_instances_operations.py index f4516e77747a..68d4e5d2bdd7 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_instances_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_instances_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ 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 import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._backup_instances_operations import ( build_adhoc_backup_request, build_create_or_update_request, @@ -49,13 +49,14 @@ build_trigger_restore_request, build_validate_cross_region_restore_request, build_validate_for_backup_request, + build_validate_for_modify_backup_request, build_validate_for_restore_request, ) if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -102,7 +103,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BackupInstanceResourceList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -121,7 +122,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -137,7 +137,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 @@ -183,7 +182,7 @@ async def get( :rtype: ~azure.mgmt.dataprotection.models.BackupInstanceResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -206,7 +205,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -220,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("BackupInstanceResource", pipeline_response) + deserialized = self._deserialize("BackupInstanceResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -235,8 +233,8 @@ async def _create_or_update_initial( parameters: Union[_models.BackupInstanceResource, IO[bytes]], x_ms_authorization_auxiliary: Optional[str] = None, **kwargs: Any - ) -> Optional[_models.BackupInstanceResource]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -249,7 +247,7 @@ async def _create_or_update_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.BackupInstanceResource]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -272,10 +270,10 @@ async def _create_or_update_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 ) @@ -283,23 +281,22 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 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("BackupInstanceResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("BackupInstanceResource", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Azure-AsyncOperation"] = self._deserialize( "str", response.headers.get("Azure-AsyncOperation") ) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -428,10 +425,11 @@ async def begin_create_or_update( 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("BackupInstanceResource", pipeline_response) + deserialized = self._deserialize("BackupInstanceResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -453,15 +451,15 @@ 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, resource_group_name: str, vault_name: str, backup_instance_name: str, x_ms_authorization_auxiliary: Optional[str] = None, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -473,7 +471,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( resource_group_name=resource_group_name, @@ -485,10 +483,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 ) @@ -496,6 +494,10 @@ 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) @@ -507,8 +509,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements ) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -543,7 +549,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( resource_group_name=resource_group_name, vault_name=vault_name, backup_instance_name=backup_instance_name, @@ -554,6 +560,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 @@ -582,8 +589,8 @@ async def _adhoc_backup_initial( backup_instance_name: str, parameters: Union[_models.TriggerBackupRequest, IO[bytes]], **kwargs: Any - ) -> Optional[_models.OperationJobExtendedInfo]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -596,7 +603,7 @@ async def _adhoc_backup_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.OperationJobExtendedInfo]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -618,10 +625,10 @@ async def _adhoc_backup_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 ) @@ -629,14 +636,14 @@ async def _adhoc_backup_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("OperationJobExtendedInfo", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Azure-AsyncOperation"] = self._deserialize( @@ -644,6 +651,8 @@ async def _adhoc_backup_initial( ) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -762,10 +771,11 @@ async def begin_adhoc_backup( 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("OperationJobExtendedInfo", pipeline_response) + deserialized = self._deserialize("OperationJobExtendedInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -795,8 +805,8 @@ async def _validate_for_backup_initial( vault_name: str, parameters: Union[_models.ValidateForBackupRequest, IO[bytes]], **kwargs: Any - ) -> Optional[_models.OperationJobExtendedInfo]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -809,7 +819,7 @@ async def _validate_for_backup_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.OperationJobExtendedInfo]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -830,10 +840,10 @@ async def _validate_for_backup_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 ) @@ -841,14 +851,14 @@ async def _validate_for_backup_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("OperationJobExtendedInfo", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Azure-AsyncOperation"] = self._deserialize( @@ -856,6 +866,8 @@ async def _validate_for_backup_initial( ) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -964,10 +976,11 @@ async def begin_validate_for_backup( 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("OperationJobExtendedInfo", pipeline_response) + deserialized = self._deserialize("OperationJobExtendedInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -991,6 +1004,213 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) + async def _validate_for_modify_backup_initial( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: Union[_models.ValidateForModifyBackupRequest, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ValidateForModifyBackupRequest") + + _request = build_validate_for_modify_backup_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_validate_for_modify_backup( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: _models.ValidateForModifyBackupRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Validate whether update for backup instance will be successful or not. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the backup instance. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.ValidateForModifyBackupRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_validate_for_modify_backup( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Validate whether update for backup instance will be successful or not. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the backup instance. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_validate_for_modify_backup( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: Union[_models.ValidateForModifyBackupRequest, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Validate whether update for backup instance will be successful or not. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the backup instance. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Is either a ValidateForModifyBackupRequest type + or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.dataprotection.models.ValidateForModifyBackupRequest or IO[bytes] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + 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) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + 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._validate_for_modify_backup_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + 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 + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + @distributed_trace_async async def get_backup_instance_operation_result( self, resource_group_name: str, vault_name: str, backup_instance_name: str, operation_id: str, **kwargs: Any @@ -1010,7 +1230,7 @@ async def get_backup_instance_operation_result( :rtype: ~azure.mgmt.dataprotection.models.BackupInstanceResource or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1034,7 +1254,6 @@ async def get_backup_instance_operation_result( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1050,7 +1269,7 @@ async def get_backup_instance_operation_result( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("BackupInstanceResource", pipeline_response) + deserialized = self._deserialize("BackupInstanceResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1063,8 +1282,8 @@ async def _trigger_cross_region_restore_initial( location: str, parameters: Union[_models.CrossRegionRestoreRequestObject, IO[bytes]], **kwargs: Any - ) -> Optional[_models.OperationJobExtendedInfo]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1077,7 +1296,7 @@ async def _trigger_cross_region_restore_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.OperationJobExtendedInfo]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1098,10 +1317,10 @@ async def _trigger_cross_region_restore_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 ) @@ -1109,15 +1328,15 @@ async def _trigger_cross_region_restore_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) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("OperationJobExtendedInfo", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Azure-AsyncOperation"] = self._deserialize( @@ -1125,6 +1344,8 @@ async def _trigger_cross_region_restore_initial( ) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1234,10 +1455,11 @@ async def begin_trigger_cross_region_restore( 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("OperationJobExtendedInfo", pipeline_response) + deserialized = self._deserialize("OperationJobExtendedInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1267,8 +1489,8 @@ async def _validate_cross_region_restore_initial( location: str, parameters: Union[_models.ValidateCrossRegionRestoreRequestObject, IO[bytes]], **kwargs: Any - ) -> Optional[_models.OperationJobExtendedInfo]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1281,7 +1503,7 @@ async def _validate_cross_region_restore_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.OperationJobExtendedInfo]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1302,10 +1524,10 @@ async def _validate_cross_region_restore_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 ) @@ -1313,15 +1535,15 @@ async def _validate_cross_region_restore_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) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("OperationJobExtendedInfo", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Azure-AsyncOperation"] = self._deserialize( @@ -1329,6 +1551,8 @@ async def _validate_cross_region_restore_initial( ) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1438,10 +1662,11 @@ async def begin_validate_cross_region_restore( 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("OperationJobExtendedInfo", pipeline_response) + deserialized = self._deserialize("OperationJobExtendedInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1465,15 +1690,15 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _trigger_rehydrate_initial( # pylint: disable=inconsistent-return-statements + async def _trigger_rehydrate_initial( self, resource_group_name: str, vault_name: str, backup_instance_name: str, parameters: Union[_models.AzureBackupRehydrationRequest, IO[bytes]], **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1486,7 +1711,7 @@ async def _trigger_rehydrate_initial( # pylint: disable=inconsistent-return-sta 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 @@ -1508,10 +1733,10 @@ async def _trigger_rehydrate_initial( # pylint: disable=inconsistent-return-sta 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 ) @@ -1519,6 +1744,10 @@ async def _trigger_rehydrate_initial( # pylint: disable=inconsistent-return-sta response = pipeline_response.http_response if response.status_code not in [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) @@ -1530,8 +1759,12 @@ async def _trigger_rehydrate_initial( # pylint: disable=inconsistent-return-sta ) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @overload async def begin_trigger_rehydrate( @@ -1628,7 +1861,7 @@ async def begin_trigger_rehydrate( 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_rehydrate_initial( # type: ignore + raw_result = await self._trigger_rehydrate_initial( resource_group_name=resource_group_name, vault_name=vault_name, backup_instance_name=backup_instance_name, @@ -1640,6 +1873,7 @@ async def begin_trigger_rehydrate( 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 @@ -1669,8 +1903,8 @@ async def _trigger_restore_initial( parameters: Union[_models.AzureBackupRestoreRequest, IO[bytes]], x_ms_authorization_auxiliary: Optional[str] = None, **kwargs: Any - ) -> Optional[_models.OperationJobExtendedInfo]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1683,7 +1917,7 @@ async def _trigger_restore_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.OperationJobExtendedInfo]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1706,10 +1940,10 @@ async def _trigger_restore_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 ) @@ -1717,14 +1951,14 @@ async def _trigger_restore_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("OperationJobExtendedInfo", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Azure-AsyncOperation"] = self._deserialize( @@ -1732,6 +1966,8 @@ async def _trigger_restore_initial( ) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1860,10 +2096,11 @@ async def begin_trigger_restore( 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("OperationJobExtendedInfo", pipeline_response) + deserialized = self._deserialize("OperationJobExtendedInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1887,10 +2124,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _resume_backups_initial( # pylint: disable=inconsistent-return-statements + async def _resume_backups_initial( self, resource_group_name: str, vault_name: str, backup_instance_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1902,7 +2139,7 @@ async def _resume_backups_initial( # pylint: disable=inconsistent-return-statem _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_resume_backups_request( resource_group_name=resource_group_name, @@ -1913,10 +2150,10 @@ async def _resume_backups_initial( # pylint: disable=inconsistent-return-statem 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 ) @@ -1924,6 +2161,10 @@ async def _resume_backups_initial( # pylint: disable=inconsistent-return-statem 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) @@ -1935,8 +2176,12 @@ async def _resume_backups_initial( # pylint: disable=inconsistent-return-statem ) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_resume_backups( @@ -1964,7 +2209,7 @@ async def begin_resume_backups( 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._resume_backups_initial( # type: ignore + raw_result = await self._resume_backups_initial( resource_group_name=resource_group_name, vault_name=vault_name, backup_instance_name=backup_instance_name, @@ -1974,6 +2219,7 @@ async def begin_resume_backups( 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 @@ -1995,10 +2241,10 @@ 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 _resume_protection_initial( # pylint: disable=inconsistent-return-statements + async def _resume_protection_initial( self, resource_group_name: str, vault_name: str, backup_instance_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2010,7 +2256,7 @@ async def _resume_protection_initial( # pylint: disable=inconsistent-return-sta _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_resume_protection_request( resource_group_name=resource_group_name, @@ -2021,10 +2267,10 @@ async def _resume_protection_initial( # pylint: disable=inconsistent-return-sta 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 ) @@ -2032,6 +2278,10 @@ async def _resume_protection_initial( # pylint: disable=inconsistent-return-sta 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) @@ -2043,8 +2293,12 @@ async def _resume_protection_initial( # pylint: disable=inconsistent-return-sta ) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_resume_protection( @@ -2072,7 +2326,7 @@ async def begin_resume_protection( 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._resume_protection_initial( # type: ignore + raw_result = await self._resume_protection_initial( resource_group_name=resource_group_name, vault_name=vault_name, backup_instance_name=backup_instance_name, @@ -2082,6 +2336,7 @@ async def begin_resume_protection( 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 @@ -2103,7 +2358,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 _stop_protection_initial( # pylint: disable=inconsistent-return-statements + async def _stop_protection_initial( self, resource_group_name: str, vault_name: str, @@ -2111,8 +2366,8 @@ async def _stop_protection_initial( # pylint: disable=inconsistent-return-state x_ms_authorization_auxiliary: Optional[str] = None, parameters: Optional[Union[_models.StopProtectionRequest, IO[bytes]]] = None, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2125,7 +2380,7 @@ async def _stop_protection_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[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2151,10 +2406,10 @@ async def _stop_protection_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 = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2162,6 +2417,10 @@ async def _stop_protection_initial( # pylint: disable=inconsistent-return-state 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) @@ -2173,8 +2432,12 @@ async def _stop_protection_initial( # pylint: disable=inconsistent-return-state ) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @overload async def begin_stop_protection( @@ -2280,7 +2543,7 @@ async def begin_stop_protection( 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._stop_protection_initial( # type: ignore + raw_result = await self._stop_protection_initial( resource_group_name=resource_group_name, vault_name=vault_name, backup_instance_name=backup_instance_name, @@ -2293,6 +2556,7 @@ async def begin_stop_protection( 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 @@ -2314,7 +2578,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 _suspend_backups_initial( # pylint: disable=inconsistent-return-statements + async def _suspend_backups_initial( self, resource_group_name: str, vault_name: str, @@ -2322,8 +2586,8 @@ async def _suspend_backups_initial( # pylint: disable=inconsistent-return-state x_ms_authorization_auxiliary: Optional[str] = None, parameters: Optional[Union[_models.SuspendBackupRequest, IO[bytes]]] = None, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2336,7 +2600,7 @@ async def _suspend_backups_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[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2362,10 +2626,10 @@ async def _suspend_backups_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 = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2373,6 +2637,10 @@ async def _suspend_backups_initial( # pylint: disable=inconsistent-return-state 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) @@ -2384,8 +2652,12 @@ async def _suspend_backups_initial( # pylint: disable=inconsistent-return-state ) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @overload async def begin_suspend_backups( @@ -2494,7 +2766,7 @@ async def begin_suspend_backups( 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._suspend_backups_initial( # type: ignore + raw_result = await self._suspend_backups_initial( resource_group_name=resource_group_name, vault_name=vault_name, backup_instance_name=backup_instance_name, @@ -2507,6 +2779,7 @@ async def begin_suspend_backups( 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 @@ -2528,15 +2801,15 @@ 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 _sync_backup_instance_initial( # pylint: disable=inconsistent-return-statements + async def _sync_backup_instance_initial( self, resource_group_name: str, vault_name: str, backup_instance_name: str, parameters: Union[_models.SyncBackupInstanceRequest, IO[bytes]], **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2549,7 +2822,7 @@ async def _sync_backup_instance_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 @@ -2571,10 +2844,10 @@ async def _sync_backup_instance_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( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2582,6 +2855,10 @@ async def _sync_backup_instance_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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2593,8 +2870,12 @@ async def _sync_backup_instance_initial( # pylint: disable=inconsistent-return- ) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @overload async def begin_sync_backup_instance( @@ -2694,7 +2975,7 @@ async def begin_sync_backup_instance( 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._sync_backup_instance_initial( # type: ignore + raw_result = await self._sync_backup_instance_initial( resource_group_name=resource_group_name, vault_name=vault_name, backup_instance_name=backup_instance_name, @@ -2706,6 +2987,7 @@ async def begin_sync_backup_instance( 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 @@ -2734,8 +3016,8 @@ async def _validate_for_restore_initial( backup_instance_name: str, parameters: Union[_models.ValidateRestoreRequestObject, IO[bytes]], **kwargs: Any - ) -> Optional[_models.OperationJobExtendedInfo]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2748,7 +3030,7 @@ async def _validate_for_restore_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.OperationJobExtendedInfo]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2770,10 +3052,10 @@ async def _validate_for_restore_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 ) @@ -2781,14 +3063,14 @@ async def _validate_for_restore_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("OperationJobExtendedInfo", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Azure-AsyncOperation"] = self._deserialize( @@ -2796,6 +3078,8 @@ async def _validate_for_restore_initial( ) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -2914,10 +3198,11 @@ async def begin_validate_for_restore( 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("OperationJobExtendedInfo", pipeline_response) + deserialized = self._deserialize("OperationJobExtendedInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_policies_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_policies_operations.py index d646d8a8e95c..25aa3d8fc19d 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_policies_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/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. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ 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_policies_operations import ( build_create_or_update_request, build_delete_request, @@ -40,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -87,7 +84,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BaseBackupPolicyResourceList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -106,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: @@ -122,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 @@ -170,7 +165,7 @@ async def get( :rtype: ~azure.mgmt.dataprotection.models.BaseBackupPolicyResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -193,7 +188,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -207,7 +201,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("BaseBackupPolicyResource", pipeline_response) + deserialized = self._deserialize("BaseBackupPolicyResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -305,7 +299,7 @@ async def create_or_update( :rtype: ~azure.mgmt.dataprotection.models.BaseBackupPolicyResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -340,7 +334,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -354,7 +347,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("BaseBackupPolicyResource", pipeline_response) + deserialized = self._deserialize("BaseBackupPolicyResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -362,9 +355,7 @@ async def create_or_update( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, vault_name: str, backup_policy_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, vault_name: str, backup_policy_name: str, **kwargs: Any) -> None: """Deletes a backup policy belonging to a backup vault. Deletes a backup policy belonging to a backup vault. @@ -380,7 +371,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -403,7 +394,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/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_vault_operation_results_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_vault_operation_results_operations.py index f94da8c73e36..b5e8a6c6bce8 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_vault_operation_results_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_vault_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. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,20 +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_vault_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 # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -72,7 +69,7 @@ async def get( :rtype: ~azure.mgmt.dataprotection.models.BackupVaultResource or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -95,7 +92,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -112,7 +108,7 @@ async def get( deserialized = None response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("BackupVaultResource", pipeline_response) + deserialized = self._deserialize("BackupVaultResource", pipeline_response.http_response) if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_vaults_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_vaults_operations.py index d51831a43ebe..44dc3949dc88 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_vaults_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_vaults_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +17,13 @@ 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 import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._backup_vaults_operations import ( build_check_name_availability_request, build_create_or_update_request, @@ -45,7 +44,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -84,7 +83,7 @@ def get_in_subscription(self, **kwargs: Any) -> AsyncIterable["_models.BackupVau api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BackupVaultResourceList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -101,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: @@ -117,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 @@ -166,7 +163,7 @@ def get_in_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BackupVaultResourceList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -184,7 +181,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -200,7 +196,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 @@ -242,7 +237,7 @@ async def get(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> :rtype: ~azure.mgmt.dataprotection.models.BackupVaultResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -264,7 +259,6 @@ async def get(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -278,7 +272,7 @@ async def get(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupVaultResource", pipeline_response) + deserialized = self._deserialize("BackupVaultResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -292,8 +286,8 @@ async def _create_or_update_initial( parameters: Union[_models.BackupVaultResource, IO[bytes]], x_ms_authorization_auxiliary: Optional[str] = None, **kwargs: Any - ) -> _models.BackupVaultResource: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -306,7 +300,7 @@ async def _create_or_update_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.BackupVaultResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -328,10 +322,10 @@ async def _create_or_update_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 ) @@ -339,14 +333,14 @@ async def _create_or_update_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("BackupVaultResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("BackupVaultResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -466,10 +460,11 @@ async def begin_create_or_update( 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("BackupVaultResource", pipeline_response) + deserialized = self._deserialize("BackupVaultResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -491,10 +486,8 @@ 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 - self, resource_group_name: str, vault_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + async def _delete_initial(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -506,7 +499,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( resource_group_name=resource_group_name, @@ -516,10 +509,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 ) @@ -527,11 +520,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(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -555,7 +556,7 @@ async def begin_delete(self, resource_group_name: str, vault_name: str, **kwargs 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( resource_group_name=resource_group_name, vault_name=vault_name, api_version=api_version, @@ -564,6 +565,7 @@ async def begin_delete(self, resource_group_name: str, vault_name: str, **kwargs 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 @@ -592,8 +594,8 @@ async def _update_initial( parameters: Union[_models.PatchResourceRequestInput, IO[bytes]], x_ms_authorization_auxiliary: Optional[str] = None, **kwargs: Any - ) -> Optional[_models.BackupVaultResource]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -606,7 +608,7 @@ async def _update_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.BackupVaultResource]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -628,10 +630,10 @@ async def _update_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 ) @@ -639,12 +641,14 @@ async def _update_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("BackupVaultResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -767,10 +771,11 @@ async def begin_update( 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("BackupVaultResource", pipeline_response) + deserialized = self._deserialize("BackupVaultResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -874,7 +879,7 @@ async def check_name_availability( :rtype: ~azure.mgmt.dataprotection.models.CheckNameAvailabilityResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -908,7 +913,6 @@ async def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -922,7 +926,7 @@ async def check_name_availability( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_data_protection_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_data_protection_operations.py index c552d0210668..9abfcbf2b92c 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_data_protection_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_data_protection_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +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._data_protection_operations import build_check_feature_support_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -118,7 +115,7 @@ async def check_feature_support( :rtype: ~azure.mgmt.dataprotection.models.FeatureValidationResponseBase :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -151,7 +148,6 @@ async def check_feature_support( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -165,7 +161,7 @@ async def check_feature_support( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FeatureValidationResponseBase", pipeline_response) + deserialized = self._deserialize("FeatureValidationResponseBase", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_data_protection_operations_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_data_protection_operations_operations.py index 912bd4e4e294..52fed5b832e5 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_data_protection_operations_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_data_protection_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. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +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._data_protection_operations_operations import build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +70,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: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -89,7 +86,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -105,7 +101,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/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_deleted_backup_instances_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_deleted_backup_instances_operations.py index 212356896b93..7383e9d2a47a 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_deleted_backup_instances_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_deleted_backup_instances_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,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar, Union, cast +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, Optional, TypeVar, Union, cast import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +16,13 @@ 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 import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -30,7 +30,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._deleted_backup_instances_operations import ( build_get_request, build_list_request, @@ -40,7 +39,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -87,7 +86,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DeletedBackupInstanceResourceList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -106,7 +105,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 +120,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 @@ -168,7 +165,7 @@ async def get( :rtype: ~azure.mgmt.dataprotection.models.DeletedBackupInstanceResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -191,7 +188,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -205,17 +201,17 @@ 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("DeletedBackupInstanceResource", pipeline_response) + deserialized = self._deserialize("DeletedBackupInstanceResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _undelete_initial( # pylint: disable=inconsistent-return-statements + async def _undelete_initial( self, resource_group_name: str, vault_name: str, backup_instance_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -227,7 +223,7 @@ async def _undelete_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_undelete_request( resource_group_name=resource_group_name, @@ -238,10 +234,10 @@ async def _undelete_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 ) @@ -249,11 +245,19 @@ async def _undelete_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) 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_undelete( @@ -281,7 +285,7 @@ async def begin_undelete( 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._undelete_initial( # type: ignore + raw_result = await self._undelete_initial( resource_group_name=resource_group_name, vault_name=vault_name, backup_instance_name=backup_instance_name, @@ -291,6 +295,7 @@ async def begin_undelete( 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/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_dpp_resource_guard_proxy_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_dpp_resource_guard_proxy_operations.py index cc99bad65d1c..13b209916e5c 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_dpp_resource_guard_proxy_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_dpp_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. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ 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._dpp_resource_guard_proxy_operations import ( build_create_or_update_request, build_delete_request, @@ -41,7 +38,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -90,7 +87,7 @@ def list( 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: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,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: @@ -125,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 @@ -175,7 +170,7 @@ async def get( :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -198,7 +193,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -212,7 +206,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 @@ -310,7 +304,7 @@ async def create_or_update( :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -345,7 +339,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -359,7 +352,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("ResourceGuardProxyBaseResource", pipeline_response) + deserialized = self._deserialize("ResourceGuardProxyBaseResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -367,7 +360,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, resource_group_name: str, vault_name: str, resource_guard_proxy_name: str, **kwargs: Any ) -> None: """Deletes the ResourceGuardProxy. @@ -385,7 +378,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -408,7 +401,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 @@ -525,7 +517,7 @@ async def unlock_delete( :rtype: ~azure.mgmt.dataprotection.models.UnlockDeleteResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -561,7 +553,6 @@ async def unlock_delete( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -575,7 +566,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/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_export_jobs_operation_result_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_export_jobs_operation_result_operations.py index a7a02c5779dc..a2f3c61b762c 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_export_jobs_operation_result_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_export_jobs_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. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,20 +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_result_operations import build_get_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +71,7 @@ async def get( :rtype: ~azure.mgmt.dataprotection.models.ExportJobsResult or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -97,7 +94,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -113,7 +109,7 @@ async def get( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ExportJobsResult", pipeline_response) + deserialized = self._deserialize("ExportJobsResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_export_jobs_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_export_jobs_operations.py index d91fe57fa53f..2ba6624908ab 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_export_jobs_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_export_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,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union, cast +from typing import Any, AsyncIterator, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,25 +14,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._export_jobs_operations import build_trigger_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -57,10 +56,8 @@ 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 - self, resource_group_name: str, vault_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + async def _trigger_initial(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -72,7 +69,7 @@ async def _trigger_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_trigger_request( resource_group_name=resource_group_name, @@ -82,10 +79,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 ) @@ -93,6 +90,10 @@ async def _trigger_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [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) @@ -101,8 +102,12 @@ async def _trigger_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_trigger(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -126,7 +131,7 @@ async def begin_trigger(self, resource_group_name: str, vault_name: str, **kwarg 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( resource_group_name=resource_group_name, vault_name=vault_name, api_version=api_version, @@ -135,6 +140,7 @@ async def begin_trigger(self, resource_group_name: str, vault_name: str, **kwarg 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/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_fetch_cross_region_restore_job_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_fetch_cross_region_restore_job_operations.py index 5f14535bfe3d..b047fb0dae1f 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_fetch_cross_region_restore_job_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_fetch_cross_region_restore_job_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +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._fetch_cross_region_restore_job_operations import build_get_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -132,7 +129,7 @@ async def get( :rtype: ~azure.mgmt.dataprotection.models.AzureBackupJobResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -166,7 +163,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -180,7 +176,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("AzureBackupJobResource", pipeline_response) + deserialized = self._deserialize("AzureBackupJobResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_fetch_cross_region_restore_jobs_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_fetch_cross_region_restore_jobs_operations.py index 9f1db3d2308c..4a37a0a74247 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_fetch_cross_region_restore_jobs_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_fetch_cross_region_restore_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. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,20 +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._fetch_cross_region_restore_jobs_operations import build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -156,7 +153,7 @@ def list( content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AzureBackupJobResourceList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -186,7 +183,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -202,7 +198,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/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_fetch_secondary_recovery_points_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_fetch_secondary_recovery_points_operations.py index b465e6646780..744677c27004 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_fetch_secondary_recovery_points_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_fetch_secondary_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. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,20 +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._fetch_secondary_recovery_points_operations import build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -169,7 +166,7 @@ def list( content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AzureBackupRecoveryPointResourceList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -200,7 +197,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -216,7 +212,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/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_jobs_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_jobs_operations.py index f4e6b3a0086b..91e69cff9b7e 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_jobs_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/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. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,21 +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._jobs_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 # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -81,7 +78,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AzureBackupJobResourceList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -100,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: @@ -116,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 @@ -163,7 +158,7 @@ async def get( :rtype: ~azure.mgmt.dataprotection.models.AzureBackupJobResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -186,7 +181,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -200,7 +194,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("AzureBackupJobResource", pipeline_response) + deserialized = self._deserialize("AzureBackupJobResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_result_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_result_operations.py index 1c74470597be..dd1b47b16d00 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_result_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_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. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,20 +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._operation_result_operations import build_get_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,7 +66,7 @@ async def get(self, operation_id: str, location: str, **kwargs: Any) -> Optional :rtype: ~azure.mgmt.dataprotection.models.OperationJobExtendedInfo or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -91,7 +88,6 @@ async def get(self, operation_id: str, location: str, **kwargs: Any) -> Optional headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -108,7 +104,7 @@ async def get(self, operation_id: str, location: str, **kwargs: Any) -> Optional deserialized = None response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("OperationJobExtendedInfo", pipeline_response) + deserialized = self._deserialize("OperationJobExtendedInfo", pipeline_response.http_response) if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_status_backup_vault_context_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_status_backup_vault_context_operations.py index 3078ec50e73e..f8782d35a9e3 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_status_backup_vault_context_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_status_backup_vault_context_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,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,20 +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._operation_status_backup_vault_context_operations import build_get_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +71,7 @@ async def get( :rtype: ~azure.mgmt.dataprotection.models.OperationResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -97,7 +94,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -111,7 +107,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("OperationResource", pipeline_response) + deserialized = self._deserialize("OperationResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_status_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_status_operations.py index c2c72b92dfd5..a1617538ee0c 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_status_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_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. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,20 +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._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 # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,7 +66,7 @@ async def get(self, location: str, operation_id: str, **kwargs: Any) -> _models. :rtype: ~azure.mgmt.dataprotection.models.OperationResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -91,7 +88,6 @@ async def get(self, location: str, operation_id: str, **kwargs: Any) -> _models. headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -105,7 +101,7 @@ async def get(self, location: str, operation_id: str, **kwargs: Any) -> _models. map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("OperationResource", pipeline_response) + deserialized = self._deserialize("OperationResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_status_resource_group_context_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_status_resource_group_context_operations.py index ef225510cb0f..d7bbc3f2d539 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_status_resource_group_context_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_status_resource_group_context_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,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,20 +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._operation_status_resource_group_context_operations import build_get_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,7 +67,7 @@ async def get(self, resource_group_name: str, operation_id: str, **kwargs: Any) :rtype: ~azure.mgmt.dataprotection.models.OperationResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -92,7 +89,6 @@ async def get(self, resource_group_name: str, operation_id: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -106,7 +102,7 @@ async def get(self, resource_group_name: str, operation_id: str, **kwargs: Any) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("OperationResource", pipeline_response) + deserialized = self._deserialize("OperationResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_recovery_points_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_recovery_points_operations.py index ab9952362e82..933eb4788828 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_recovery_points_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/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,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,21 +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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -93,7 +90,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AzureBackupRecoveryPointResourceList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -115,7 +112,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 +127,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 @@ -184,7 +179,7 @@ async def get( :rtype: ~azure.mgmt.dataprotection.models.AzureBackupRecoveryPointResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -208,7 +203,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -222,7 +216,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("AzureBackupRecoveryPointResource", pipeline_response) + deserialized = self._deserialize("AzureBackupRecoveryPointResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_resource_guards_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_resource_guards_operations.py index 9f5e35c1beff..053aaab28e8f 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_resource_guards_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_resource_guards_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +21,13 @@ 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._resource_guards_operations import ( build_delete_request, build_get_backup_security_pin_requests_objects_request, @@ -54,7 +52,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -96,7 +94,7 @@ def get_resources_in_subscription(self, **kwargs: Any) -> AsyncIterable["_models api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ResourceGuardResourceList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -113,7 +111,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -129,7 +126,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 @@ -181,7 +177,7 @@ def get_resources_in_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ResourceGuardResourceList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -199,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: @@ -215,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 @@ -326,7 +320,7 @@ async def put( :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -360,7 +354,6 @@ async def put( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -374,11 +367,7 @@ async def put( 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("ResourceGuardResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ResourceGuardResource", pipeline_response) + deserialized = self._deserialize("ResourceGuardResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -402,7 +391,7 @@ async def get( :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -424,7 +413,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -438,7 +426,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("ResourceGuardResource", pipeline_response) + deserialized = self._deserialize("ResourceGuardResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -446,9 +434,7 @@ async def get( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_guards_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, resource_guards_name: str, **kwargs: Any) -> None: """Deletes a ResourceGuard resource from the resource group. Deletes a ResourceGuard resource from the resource group. @@ -462,7 +448,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -484,7 +470,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 @@ -589,7 +574,7 @@ async def patch( :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -623,7 +608,6 @@ async def patch( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -637,7 +621,7 @@ async def patch( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceGuardResource", pipeline_response) + deserialized = self._deserialize("ResourceGuardResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -670,7 +654,7 @@ def get_disable_soft_delete_requests_objects( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DppBaseResourceList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -689,7 +673,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -705,7 +688,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 @@ -760,7 +742,7 @@ def get_delete_resource_guard_proxy_requests_objects( # pylint: disable=name-to api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DppBaseResourceList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -779,7 +761,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -795,7 +776,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 @@ -850,7 +830,7 @@ def get_backup_security_pin_requests_objects( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DppBaseResourceList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -869,7 +849,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -885,7 +864,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 @@ -940,7 +918,7 @@ def get_delete_protected_item_requests_objects( # pylint: disable=name-too-long api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DppBaseResourceList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -959,7 +937,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -975,7 +952,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 @@ -1030,7 +1006,7 @@ def get_update_protection_policy_requests_objects( # pylint: disable=name-too-l api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DppBaseResourceList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1049,7 +1025,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1065,7 +1040,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 @@ -1120,7 +1094,7 @@ def get_update_protected_item_requests_objects( # pylint: disable=name-too-long api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DppBaseResourceList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1139,7 +1113,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1155,7 +1128,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 @@ -1205,7 +1177,7 @@ async def get_default_disable_soft_delete_requests_object( # pylint: disable=na :rtype: ~azure.mgmt.dataprotection.models.DppBaseResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1228,7 +1200,6 @@ async def get_default_disable_soft_delete_requests_object( # pylint: disable=na headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1242,7 +1213,7 @@ async def get_default_disable_soft_delete_requests_object( # pylint: disable=na map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DppBaseResource", pipeline_response) + deserialized = self._deserialize("DppBaseResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1270,7 +1241,7 @@ async def get_default_delete_resource_guard_proxy_requests_object( # pylint: di :rtype: ~azure.mgmt.dataprotection.models.DppBaseResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1293,7 +1264,6 @@ async def get_default_delete_resource_guard_proxy_requests_object( # pylint: di headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1307,7 +1277,7 @@ async def get_default_delete_resource_guard_proxy_requests_object( # pylint: di map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DppBaseResource", pipeline_response) + deserialized = self._deserialize("DppBaseResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1335,7 +1305,7 @@ async def get_default_backup_security_pin_requests_object( # pylint: disable=na :rtype: ~azure.mgmt.dataprotection.models.DppBaseResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1358,7 +1328,6 @@ async def get_default_backup_security_pin_requests_object( # pylint: disable=na headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1372,7 +1341,7 @@ async def get_default_backup_security_pin_requests_object( # pylint: disable=na map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DppBaseResource", pipeline_response) + deserialized = self._deserialize("DppBaseResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1400,7 +1369,7 @@ async def get_default_delete_protected_item_requests_object( # pylint: disable= :rtype: ~azure.mgmt.dataprotection.models.DppBaseResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1423,7 +1392,6 @@ async def get_default_delete_protected_item_requests_object( # pylint: disable= headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1437,7 +1405,7 @@ async def get_default_delete_protected_item_requests_object( # pylint: disable= map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DppBaseResource", pipeline_response) + deserialized = self._deserialize("DppBaseResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1465,7 +1433,7 @@ async def get_default_update_protection_policy_requests_object( # pylint: disab :rtype: ~azure.mgmt.dataprotection.models.DppBaseResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1488,7 +1456,6 @@ async def get_default_update_protection_policy_requests_object( # pylint: disab headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1502,7 +1469,7 @@ async def get_default_update_protection_policy_requests_object( # pylint: disab map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DppBaseResource", pipeline_response) + deserialized = self._deserialize("DppBaseResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1530,7 +1497,7 @@ async def get_default_update_protected_item_requests_object( # pylint: disable= :rtype: ~azure.mgmt.dataprotection.models.DppBaseResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1553,7 +1520,6 @@ async def get_default_update_protected_item_requests_object( # pylint: disable= headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1567,7 +1533,7 @@ async def get_default_update_protected_item_requests_object( # pylint: disable= map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DppBaseResource", pipeline_response) + deserialized = self._deserialize("DppBaseResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_restorable_time_ranges_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_restorable_time_ranges_operations.py index 61d903d7b54e..1872277a7a80 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_restorable_time_ranges_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_restorable_time_ranges_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +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._restorable_time_ranges_operations import build_find_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -142,7 +139,7 @@ async def find( :rtype: ~azure.mgmt.dataprotection.models.AzureBackupFindRestorableTimeRangesResponseResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -177,7 +174,6 @@ async def find( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -191,7 +187,9 @@ async def find( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureBackupFindRestorableTimeRangesResponseResource", pipeline_response) + deserialized = self._deserialize( + "AzureBackupFindRestorableTimeRangesResponseResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/__init__.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/__init__.py index 52f37de6ee55..b55eec6becdf 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/__init__.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/__init__.py @@ -5,212 +5,226 @@ # 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 AbsoluteDeleteOption -from ._models_py3 import AdHocBackupRuleOptions -from ._models_py3 import AdhocBackupTriggerOption -from ._models_py3 import AdhocBasedTaggingCriteria -from ._models_py3 import AdhocBasedTriggerContext -from ._models_py3 import AuthCredentials -from ._models_py3 import AzureBackupDiscreteRecoveryPoint -from ._models_py3 import AzureBackupFindRestorableTimeRangesRequest -from ._models_py3 import AzureBackupFindRestorableTimeRangesRequestResource -from ._models_py3 import AzureBackupFindRestorableTimeRangesResponse -from ._models_py3 import AzureBackupFindRestorableTimeRangesResponseResource -from ._models_py3 import AzureBackupJob -from ._models_py3 import AzureBackupJobResource -from ._models_py3 import AzureBackupJobResourceList -from ._models_py3 import AzureBackupParams -from ._models_py3 import AzureBackupRecoveryPoint -from ._models_py3 import AzureBackupRecoveryPointBasedRestoreRequest -from ._models_py3 import AzureBackupRecoveryPointResource -from ._models_py3 import AzureBackupRecoveryPointResourceList -from ._models_py3 import AzureBackupRecoveryTimeBasedRestoreRequest -from ._models_py3 import AzureBackupRehydrationRequest -from ._models_py3 import AzureBackupRestoreRequest -from ._models_py3 import AzureBackupRestoreWithRehydrationRequest -from ._models_py3 import AzureBackupRule -from ._models_py3 import AzureMonitorAlertSettings -from ._models_py3 import AzureOperationalStoreParameters -from ._models_py3 import AzureRetentionRule -from ._models_py3 import BackupCriteria -from ._models_py3 import BackupDatasourceParameters -from ._models_py3 import BackupInstance -from ._models_py3 import BackupInstanceResource -from ._models_py3 import BackupInstanceResourceList -from ._models_py3 import BackupParameters -from ._models_py3 import BackupPolicy -from ._models_py3 import BackupSchedule -from ._models_py3 import BackupVault -from ._models_py3 import BackupVaultResource -from ._models_py3 import BackupVaultResourceList -from ._models_py3 import BaseBackupPolicy -from ._models_py3 import BaseBackupPolicyResource -from ._models_py3 import BaseBackupPolicyResourceList -from ._models_py3 import BasePolicyRule -from ._models_py3 import BaseResourceProperties -from ._models_py3 import BlobBackupDatasourceParameters -from ._models_py3 import CheckNameAvailabilityRequest -from ._models_py3 import CheckNameAvailabilityResult -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 CmkKekIdentity -from ._models_py3 import CmkKeyVaultProperties -from ._models_py3 import CopyOnExpiryOption -from ._models_py3 import CopyOption -from ._models_py3 import CrossRegionRestoreDetails -from ._models_py3 import CrossRegionRestoreJobRequest -from ._models_py3 import CrossRegionRestoreJobsRequest -from ._models_py3 import CrossRegionRestoreRequestObject -from ._models_py3 import CrossRegionRestoreSettings -from ._models_py3 import CrossSubscriptionRestoreSettings -from ._models_py3 import CustomCopyOption -from ._models_py3 import DataStoreInfoBase -from ._models_py3 import DataStoreParameters -from ._models_py3 import Datasource -from ._models_py3 import DatasourceSet -from ._models_py3 import Day -from ._models_py3 import DefaultResourceProperties -from ._models_py3 import DeleteOption -from ._models_py3 import DeletedBackupInstance -from ._models_py3 import DeletedBackupInstanceResource -from ._models_py3 import DeletedBackupInstanceResourceList -from ._models_py3 import DeletionInfo -from ._models_py3 import DppBaseResource -from ._models_py3 import DppBaseResourceList -from ._models_py3 import DppBaseTrackedResource -from ._models_py3 import DppIdentityDetails -from ._models_py3 import DppProxyResource -from ._models_py3 import DppResource -from ._models_py3 import DppResourceList -from ._models_py3 import DppTrackedResource -from ._models_py3 import DppTrackedResourceList -from ._models_py3 import DppWorkerRequest -from ._models_py3 import EncryptionSettings -from ._models_py3 import Error -from ._models_py3 import ErrorAdditionalInfo -from ._models_py3 import ErrorDetail -from ._models_py3 import ErrorResponse -from ._models_py3 import ExportJobsResult -from ._models_py3 import FeatureSettings -from ._models_py3 import FeatureValidationRequest -from ._models_py3 import FeatureValidationRequestBase -from ._models_py3 import FeatureValidationResponse -from ._models_py3 import FeatureValidationResponseBase -from ._models_py3 import FetchSecondaryRPsRequestParameters -from ._models_py3 import IdentityDetails -from ._models_py3 import ImmediateCopyOption -from ._models_py3 import ImmutabilitySettings -from ._models_py3 import InnerError -from ._models_py3 import ItemLevelRestoreCriteria -from ._models_py3 import ItemLevelRestoreTargetInfo -from ._models_py3 import ItemPathBasedRestoreCriteria -from ._models_py3 import JobExtendedInfo -from ._models_py3 import JobSubTask -from ._models_py3 import KubernetesClusterBackupDatasourceParameters -from ._models_py3 import KubernetesClusterRestoreCriteria -from ._models_py3 import KubernetesClusterVaultTierRestoreCriteria -from ._models_py3 import KubernetesPVRestoreCriteria -from ._models_py3 import KubernetesStorageClassRestoreCriteria -from ._models_py3 import MonitoringSettings -from ._models_py3 import NamespacedNameResource -from ._models_py3 import OperationExtendedInfo -from ._models_py3 import OperationJobExtendedInfo -from ._models_py3 import OperationResource -from ._models_py3 import PatchBackupVaultInput -from ._models_py3 import PatchResourceGuardInput -from ._models_py3 import PatchResourceRequestInput -from ._models_py3 import PolicyInfo -from ._models_py3 import PolicyParameters -from ._models_py3 import ProtectionStatusDetails -from ._models_py3 import RangeBasedItemLevelRestoreCriteria -from ._models_py3 import RecoveryPointDataStoreDetails -from ._models_py3 import RecoveryPointsFilters -from ._models_py3 import ResourceGuard -from ._models_py3 import ResourceGuardOperation -from ._models_py3 import ResourceGuardOperationDetail -from ._models_py3 import ResourceGuardProxyBase -from ._models_py3 import ResourceGuardProxyBaseResource -from ._models_py3 import ResourceGuardProxyBaseResourceList -from ._models_py3 import ResourceGuardResource -from ._models_py3 import ResourceGuardResourceList -from ._models_py3 import ResourceMoveDetails -from ._models_py3 import RestorableTimeRange -from ._models_py3 import RestoreFilesTargetInfo -from ._models_py3 import RestoreJobRecoveryPointDetails -from ._models_py3 import RestoreTargetInfo -from ._models_py3 import RestoreTargetInfoBase -from ._models_py3 import RetentionTag -from ._models_py3 import ScheduleBasedBackupCriteria -from ._models_py3 import ScheduleBasedTriggerContext -from ._models_py3 import SecretStoreBasedAuthCredentials -from ._models_py3 import SecretStoreResource -from ._models_py3 import SecuritySettings -from ._models_py3 import SoftDeleteSettings -from ._models_py3 import SourceLifeCycle -from ._models_py3 import StopProtectionRequest -from ._models_py3 import StorageSetting -from ._models_py3 import SupportedFeature -from ._models_py3 import SuspendBackupRequest -from ._models_py3 import SyncBackupInstanceRequest -from ._models_py3 import SystemData -from ._models_py3 import TaggingCriteria -from ._models_py3 import TargetCopySetting -from ._models_py3 import TargetDetails -from ._models_py3 import TriggerBackupRequest -from ._models_py3 import TriggerContext -from ._models_py3 import UnlockDeleteRequest -from ._models_py3 import UnlockDeleteResponse -from ._models_py3 import UserAssignedIdentity -from ._models_py3 import UserFacingError -from ._models_py3 import UserFacingWarningDetail -from ._models_py3 import ValidateCrossRegionRestoreRequestObject -from ._models_py3 import ValidateForBackupRequest -from ._models_py3 import ValidateRestoreRequestObject +from typing import TYPE_CHECKING -from ._data_protection_mgmt_client_enums import AbsoluteMarker -from ._data_protection_mgmt_client_enums import AlertsState -from ._data_protection_mgmt_client_enums import BCDRSecurityLevel -from ._data_protection_mgmt_client_enums import CreatedByType -from ._data_protection_mgmt_client_enums import CrossRegionRestoreState -from ._data_protection_mgmt_client_enums import CrossSubscriptionRestoreState -from ._data_protection_mgmt_client_enums import CurrentProtectionState -from ._data_protection_mgmt_client_enums import DataStoreTypes -from ._data_protection_mgmt_client_enums import DayOfWeek -from ._data_protection_mgmt_client_enums import EncryptionState -from ._data_protection_mgmt_client_enums import ExistingResourcePolicy -from ._data_protection_mgmt_client_enums import FeatureSupportStatus -from ._data_protection_mgmt_client_enums import FeatureType -from ._data_protection_mgmt_client_enums import IdentityType -from ._data_protection_mgmt_client_enums import ImmutabilityState -from ._data_protection_mgmt_client_enums import InfrastructureEncryptionState -from ._data_protection_mgmt_client_enums import Month -from ._data_protection_mgmt_client_enums import PersistentVolumeRestoreMode -from ._data_protection_mgmt_client_enums import ProvisioningState -from ._data_protection_mgmt_client_enums import RecoveryOption -from ._data_protection_mgmt_client_enums import RecoveryPointCompletionState -from ._data_protection_mgmt_client_enums import RehydrationPriority -from ._data_protection_mgmt_client_enums import RehydrationStatus -from ._data_protection_mgmt_client_enums import ResourceMoveState -from ._data_protection_mgmt_client_enums import ResourcePropertiesObjectType -from ._data_protection_mgmt_client_enums import RestoreSourceDataStoreType -from ._data_protection_mgmt_client_enums import RestoreTargetLocationType -from ._data_protection_mgmt_client_enums import SecretStoreType -from ._data_protection_mgmt_client_enums import SecureScoreLevel -from ._data_protection_mgmt_client_enums import SoftDeleteState -from ._data_protection_mgmt_client_enums import SourceDataStoreType -from ._data_protection_mgmt_client_enums import Status -from ._data_protection_mgmt_client_enums import StorageSettingStoreTypes -from ._data_protection_mgmt_client_enums import StorageSettingTypes -from ._data_protection_mgmt_client_enums import SyncType -from ._data_protection_mgmt_client_enums import ValidationType -from ._data_protection_mgmt_client_enums import WeekNumber +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + AbsoluteDeleteOption, + AdHocBackupRuleOptions, + AdhocBackupTriggerOption, + AdhocBasedTaggingCriteria, + AdhocBasedTriggerContext, + AdlsBlobBackupDatasourceParameters, + AuthCredentials, + AzureBackupDiscreteRecoveryPoint, + AzureBackupFindRestorableTimeRangesRequest, + AzureBackupFindRestorableTimeRangesRequestResource, + AzureBackupFindRestorableTimeRangesResponse, + AzureBackupFindRestorableTimeRangesResponseResource, + AzureBackupJob, + AzureBackupJobResource, + AzureBackupJobResourceList, + AzureBackupParams, + AzureBackupRecoveryPoint, + AzureBackupRecoveryPointBasedRestoreRequest, + AzureBackupRecoveryPointResource, + AzureBackupRecoveryPointResourceList, + AzureBackupRecoveryTimeBasedRestoreRequest, + AzureBackupRehydrationRequest, + AzureBackupRestoreRequest, + AzureBackupRestoreWithRehydrationRequest, + AzureBackupRule, + AzureMonitorAlertSettings, + AzureOperationalStoreParameters, + AzureRetentionRule, + BackupCriteria, + BackupDatasourceParameters, + BackupInstance, + BackupInstanceResource, + BackupInstanceResourceList, + BackupParameters, + BackupPolicy, + BackupSchedule, + BackupVault, + BackupVaultResource, + BackupVaultResourceList, + BaseBackupPolicy, + BaseBackupPolicyResource, + BaseBackupPolicyResourceList, + BasePolicyRule, + BaseResourceProperties, + BlobBackupDatasourceParameters, + CheckNameAvailabilityRequest, + CheckNameAvailabilityResult, + ClientDiscoveryDisplay, + ClientDiscoveryForLogSpecification, + ClientDiscoveryForProperties, + ClientDiscoveryForServiceSpecification, + ClientDiscoveryResponse, + ClientDiscoveryValueForSingleApi, + CmkKekIdentity, + CmkKeyVaultProperties, + CopyOnExpiryOption, + CopyOption, + CrossRegionRestoreDetails, + CrossRegionRestoreJobRequest, + CrossRegionRestoreJobsRequest, + CrossRegionRestoreRequestObject, + CrossRegionRestoreSettings, + CrossSubscriptionRestoreSettings, + CustomCopyOption, + DataStoreInfoBase, + DataStoreParameters, + Datasource, + DatasourceSet, + Day, + DefaultResourceProperties, + DeleteOption, + DeletedBackupInstance, + DeletedBackupInstanceResource, + DeletedBackupInstanceResourceList, + DeletionInfo, + DppBaseResource, + DppBaseResourceList, + DppBaseTrackedResource, + DppIdentityDetails, + DppProxyResource, + DppResource, + DppResourceList, + DppTrackedResource, + DppTrackedResourceList, + DppWorkerRequest, + EncryptionSettings, + Error, + ErrorAdditionalInfo, + ErrorDetail, + ErrorResponse, + ExportJobsResult, + FeatureSettings, + FeatureValidationRequest, + FeatureValidationRequestBase, + FeatureValidationResponse, + FeatureValidationResponseBase, + FetchSecondaryRPsRequestParameters, + IdentityDetails, + ImmediateCopyOption, + ImmutabilitySettings, + InnerError, + ItemLevelRestoreCriteria, + ItemLevelRestoreTargetInfo, + ItemPathBasedRestoreCriteria, + JobExtendedInfo, + JobSubTask, + KubernetesClusterBackupDatasourceParameters, + KubernetesClusterRestoreCriteria, + KubernetesClusterVaultTierRestoreCriteria, + KubernetesPVRestoreCriteria, + KubernetesStorageClassRestoreCriteria, + MonitoringSettings, + NamespacedNameResource, + OperationExtendedInfo, + OperationJobExtendedInfo, + OperationResource, + PatchBackupVaultInput, + PatchResourceGuardInput, + PatchResourceRequestInput, + PolicyInfo, + PolicyParameters, + ProtectionStatusDetails, + RangeBasedItemLevelRestoreCriteria, + RecoveryPointDataStoreDetails, + RecoveryPointsFilters, + ResourceGuard, + ResourceGuardOperation, + ResourceGuardOperationDetail, + ResourceGuardProxyBase, + ResourceGuardProxyBaseResource, + ResourceGuardProxyBaseResourceList, + ResourceGuardResource, + ResourceGuardResourceList, + ResourceMoveDetails, + RestorableTimeRange, + RestoreFilesTargetInfo, + RestoreJobRecoveryPointDetails, + RestoreTargetInfo, + RestoreTargetInfoBase, + RetentionTag, + ScheduleBasedBackupCriteria, + ScheduleBasedTriggerContext, + SecretStoreBasedAuthCredentials, + SecretStoreResource, + SecuritySettings, + SoftDeleteSettings, + SourceLifeCycle, + StopProtectionRequest, + StorageSetting, + SupportedFeature, + SuspendBackupRequest, + SyncBackupInstanceRequest, + SystemData, + TaggingCriteria, + TargetCopySetting, + TargetDetails, + TriggerBackupRequest, + TriggerContext, + UnlockDeleteRequest, + UnlockDeleteResponse, + UserAssignedIdentity, + UserFacingError, + UserFacingWarningDetail, + ValidateCrossRegionRestoreRequestObject, + ValidateForBackupRequest, + ValidateForModifyBackupRequest, + ValidateRestoreRequestObject, +) + +from ._data_protection_mgmt_client_enums import ( # type: ignore + AKSVolumeTypes, + AbsoluteMarker, + AlertsState, + BCDRSecurityLevel, + CreatedByType, + CrossRegionRestoreState, + CrossSubscriptionRestoreState, + CurrentProtectionState, + DataStoreTypes, + DayOfWeek, + EncryptionState, + ExistingResourcePolicy, + FeatureSupportStatus, + FeatureType, + IdentityType, + ImmutabilityState, + InfrastructureEncryptionState, + Month, + PersistentVolumeRestoreMode, + ProvisioningState, + RecoveryOption, + RecoveryPointCompletionState, + RehydrationPriority, + RehydrationStatus, + ResourceMoveState, + ResourcePropertiesObjectType, + RestoreSourceDataStoreType, + RestoreTargetLocationType, + SecretStoreType, + SecureScoreLevel, + SoftDeleteState, + SourceDataStoreType, + Status, + StorageSettingStoreTypes, + StorageSettingTypes, + SyncType, + ValidationType, + WeekNumber, +) 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__ = [ @@ -219,6 +233,7 @@ "AdhocBackupTriggerOption", "AdhocBasedTaggingCriteria", "AdhocBasedTriggerContext", + "AdlsBlobBackupDatasourceParameters", "AuthCredentials", "AzureBackupDiscreteRecoveryPoint", "AzureBackupFindRestorableTimeRangesRequest", @@ -378,7 +393,9 @@ "UserFacingWarningDetail", "ValidateCrossRegionRestoreRequestObject", "ValidateForBackupRequest", + "ValidateForModifyBackupRequest", "ValidateRestoreRequestObject", + "AKSVolumeTypes", "AbsoluteMarker", "AlertsState", "BCDRSecurityLevel", @@ -417,5 +434,5 @@ "ValidationType", "WeekNumber", ] -__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/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/_data_protection_mgmt_client_enums.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/_data_protection_mgmt_client_enums.py index 4cb5779c5255..76452c4f4e7b 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/_data_protection_mgmt_client_enums.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/_data_protection_mgmt_client_enums.py @@ -20,6 +20,13 @@ class AbsoluteMarker(str, Enum, metaclass=CaseInsensitiveEnumMeta): FIRST_OF_YEAR = "FirstOfYear" +class AKSVolumeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AKSVolumeTypes.""" + + AZURE_DISK = "AzureDisk" + AZURE_FILE_SHARE_SMB = "AzureFileShareSMB" + + class AlertsState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """AlertsState.""" @@ -256,7 +263,6 @@ class RestoreSourceDataStoreType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Gets or sets the type of the source data store.""" OPERATIONAL_STORE = "OperationalStore" - VAULT_STORE = "VaultStore" ARCHIVE_STORE = "ArchiveStore" diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/_models_py3.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/_models_py3.py index d8d4e2f07212..fc83e3396397 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/_models_py3.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/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 @@ -221,6 +220,109 @@ def __init__(self, *, tagging_criteria: "_models.AdhocBasedTaggingCriteria", **k self.tagging_criteria = tagging_criteria +class BackupDatasourceParameters(_serialization.Model): + """Parameters for Backup Datasource. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + BlobBackupDatasourceParameters, KubernetesClusterBackupDatasourceParameters + + All required parameters must be populated in order to send to server. + + :ivar object_type: Type of the specific object - used for deserializing. Required. + :vartype object_type: str + """ + + _validation = { + "object_type": {"required": True}, + } + + _attribute_map = { + "object_type": {"key": "objectType", "type": "str"}, + } + + _subtype_map = { + "object_type": { + "BlobBackupDatasourceParameters": "BlobBackupDatasourceParameters", + "KubernetesClusterBackupDatasourceParameters": "KubernetesClusterBackupDatasourceParameters", + } + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.object_type: Optional[str] = None + + +class BlobBackupDatasourceParameters(BackupDatasourceParameters): + """Parameters to be used during configuration of backup of blobs. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AdlsBlobBackupDatasourceParameters + + All required parameters must be populated in order to send to server. + + :ivar object_type: Type of the specific object - used for deserializing. Required. + :vartype object_type: str + :ivar containers_list: List of containers to be backed up during configuration of backup of + blobs. Required. + :vartype containers_list: list[str] + """ + + _validation = { + "object_type": {"required": True}, + "containers_list": {"required": True}, + } + + _attribute_map = { + "object_type": {"key": "objectType", "type": "str"}, + "containers_list": {"key": "containersList", "type": "[str]"}, + } + + _subtype_map = {"object_type": {"AdlsBlobBackupDatasourceParameters": "AdlsBlobBackupDatasourceParameters"}} + + def __init__(self, *, containers_list: List[str], **kwargs: Any) -> None: + """ + :keyword containers_list: List of containers to be backed up during configuration of backup of + blobs. Required. + :paramtype containers_list: list[str] + """ + super().__init__(**kwargs) + self.object_type: str = "BlobBackupDatasourceParameters" + self.containers_list = containers_list + + +class AdlsBlobBackupDatasourceParameters(BlobBackupDatasourceParameters): + """Parameters to be used during configuration of backup of azure data lake storage account blobs. + + All required parameters must be populated in order to send to server. + + :ivar object_type: Type of the specific object - used for deserializing. Required. + :vartype object_type: str + :ivar containers_list: List of containers to be backed up during configuration of backup of + blobs. Required. + :vartype containers_list: list[str] + """ + + _validation = { + "object_type": {"required": True}, + "containers_list": {"required": True}, + } + + _attribute_map = { + "object_type": {"key": "objectType", "type": "str"}, + "containers_list": {"key": "containersList", "type": "[str]"}, + } + + def __init__(self, *, containers_list: List[str], **kwargs: Any) -> None: + """ + :keyword containers_list: List of containers to be backed up during configuration of backup of + blobs. Required. + :paramtype containers_list: list[str] + """ + super().__init__(containers_list=containers_list, **kwargs) + self.object_type: str = "AdlsBlobBackupDatasourceParameters" + + class AuthCredentials(_serialization.Model): """Base class for different types of authentication credentials. @@ -277,7 +379,7 @@ def __init__(self, **kwargs: Any) -> None: self.object_type: Optional[str] = None -class AzureBackupDiscreteRecoveryPoint(AzureBackupRecoveryPoint): # pylint: disable=too-many-instance-attributes +class AzureBackupDiscreteRecoveryPoint(AzureBackupRecoveryPoint): """Azure backup discrete RecoveryPoint. Variables are only populated by the server, and will be ignored when sending a request. @@ -400,7 +502,7 @@ class AzureBackupFindRestorableTimeRangesRequest(_serialization.Model): # pylin All required parameters must be populated in order to send to server. :ivar source_data_store_type: Gets or sets the type of the source data store. Required. Known - values are: "OperationalStore", "VaultStore", and "ArchiveStore". + values are: "OperationalStore" and "ArchiveStore". :vartype source_data_store_type: str or ~azure.mgmt.dataprotection.models.RestoreSourceDataStoreType :ivar start_time: Start time for the List Restore Ranges request. ISO 8601 format. @@ -429,7 +531,7 @@ def __init__( ) -> None: """ :keyword source_data_store_type: Gets or sets the type of the source data store. Required. - Known values are: "OperationalStore", "VaultStore", and "ArchiveStore". + Known values are: "OperationalStore" and "ArchiveStore". :paramtype source_data_store_type: str or ~azure.mgmt.dataprotection.models.RestoreSourceDataStoreType :keyword start_time: Start time for the List Restore Ranges request. ISO 8601 format. @@ -708,7 +810,7 @@ def __init__( self.properties = properties -class AzureBackupJob(_serialization.Model): # pylint: disable=too-many-instance-attributes +class AzureBackupJob(_serialization.Model): """AzureBackup Job Class. Variables are only populated by the server, and will be ignored when sending a request. @@ -767,8 +869,8 @@ class AzureBackupJob(_serialization.Model): # pylint: disable=too-many-instance :vartype source_subscription_id: str :ivar start_time: StartTime of the job(in UTC). Required. :vartype start_time: ~datetime.datetime - :ivar status: Status of the job like InProgress/Success/Failed/Cancelled/SuccessWithWarning. - Required. + :ivar status: Status of the job like + InProgress/Completed/Failed/Cancelled/CompletedWithWarnings/Cancelling/Paused. Required. :vartype status: str :ivar subscription_id: Subscription Id of the corresponding backup vault. Required. :vartype subscription_id: str @@ -908,8 +1010,8 @@ def __init__( # pylint: disable=too-many-locals :paramtype source_subscription_id: str :keyword start_time: StartTime of the job(in UTC). Required. :paramtype start_time: ~datetime.datetime - :keyword status: Status of the job like InProgress/Success/Failed/Cancelled/SuccessWithWarning. - Required. + :keyword status: Status of the job like + InProgress/Completed/Failed/Cancelled/CompletedWithWarnings/Cancelling/Paused. Required. :paramtype status: str :keyword subscription_id: Subscription Id of the corresponding backup vault. Required. :paramtype subscription_id: str @@ -1876,40 +1978,7 @@ def __init__(self, **kwargs: Any) -> None: self.object_type: Optional[str] = None -class BackupDatasourceParameters(_serialization.Model): - """Parameters for Backup Datasource. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - BlobBackupDatasourceParameters, KubernetesClusterBackupDatasourceParameters - - All required parameters must be populated in order to send to server. - - :ivar object_type: Type of the specific object - used for deserializing. Required. - :vartype object_type: str - """ - - _validation = { - "object_type": {"required": True}, - } - - _attribute_map = { - "object_type": {"key": "objectType", "type": "str"}, - } - - _subtype_map = { - "object_type": { - "BlobBackupDatasourceParameters": "BlobBackupDatasourceParameters", - "KubernetesClusterBackupDatasourceParameters": "KubernetesClusterBackupDatasourceParameters", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.object_type: Optional[str] = None - - -class BackupInstance(_serialization.Model): # pylint: disable=too-many-instance-attributes +class BackupInstance(_serialization.Model): """Backup Instance. Variables are only populated by the server, and will be ignored when sending a request. @@ -2277,7 +2346,7 @@ def __init__(self, *, repeating_time_intervals: List[str], time_zone: Optional[s self.time_zone = time_zone -class BackupVault(_serialization.Model): # pylint: disable=too-many-instance-attributes +class BackupVault(_serialization.Model): """Backup Vault. Variables are only populated by the server, and will be ignored when sending a request. @@ -2723,39 +2792,6 @@ def __init__(self, **kwargs: Any) -> None: self.object_type: Optional[str] = None -class BlobBackupDatasourceParameters(BackupDatasourceParameters): - """Parameters to be used during configuration of backup of blobs. - - All required parameters must be populated in order to send to server. - - :ivar object_type: Type of the specific object - used for deserializing. Required. - :vartype object_type: str - :ivar containers_list: List of containers to be backed up during configuration of backup of - blobs. Required. - :vartype containers_list: list[str] - """ - - _validation = { - "object_type": {"required": True}, - "containers_list": {"required": True}, - } - - _attribute_map = { - "object_type": {"key": "objectType", "type": "str"}, - "containers_list": {"key": "containersList", "type": "[str]"}, - } - - def __init__(self, *, containers_list: List[str], **kwargs: Any) -> None: - """ - :keyword containers_list: List of containers to be backed up during configuration of backup of - blobs. Required. - :paramtype containers_list: list[str] - """ - super().__init__(**kwargs) - self.object_type: str = "BlobBackupDatasourceParameters" - self.containers_list = containers_list - - class CheckNameAvailabilityRequest(_serialization.Model): """CheckNameAvailability Request. @@ -3630,7 +3666,7 @@ def __init__(self, **kwargs: Any) -> None: self.object_type: str = "DefaultResourceProperties" -class DeletedBackupInstance(BackupInstance): # pylint: disable=too-many-instance-attributes +class DeletedBackupInstance(BackupInstance): """Deleted Backup Instance. Variables are only populated by the server, and will be ignored when sending a request. @@ -4922,6 +4958,9 @@ class KubernetesClusterBackupDatasourceParameters(BackupDatasourceParameters): :ivar snapshot_volumes: Gets or sets the volume snapshot property. This property if enabled will take volume snapshots during backup. Required. :vartype snapshot_volumes: bool + :ivar included_volume_types: Gets or sets the include volume types property. This property sets + the volume types to be included during backup. + :vartype included_volume_types: list[str or ~azure.mgmt.dataprotection.models.AKSVolumeTypes] :ivar include_cluster_scope_resources: Gets or sets the include cluster resources property. This property if enabled will include cluster scope resources during backup. Required. :vartype include_cluster_scope_resources: bool @@ -4954,6 +4993,7 @@ class KubernetesClusterBackupDatasourceParameters(BackupDatasourceParameters): _attribute_map = { "object_type": {"key": "objectType", "type": "str"}, "snapshot_volumes": {"key": "snapshotVolumes", "type": "bool"}, + "included_volume_types": {"key": "includedVolumeTypes", "type": "[str]"}, "include_cluster_scope_resources": {"key": "includeClusterScopeResources", "type": "bool"}, "included_namespaces": {"key": "includedNamespaces", "type": "[str]"}, "excluded_namespaces": {"key": "excludedNamespaces", "type": "[str]"}, @@ -4968,6 +5008,7 @@ def __init__( *, snapshot_volumes: bool, include_cluster_scope_resources: bool, + included_volume_types: Optional[List[Union[str, "_models.AKSVolumeTypes"]]] = None, included_namespaces: Optional[List[str]] = None, excluded_namespaces: Optional[List[str]] = None, included_resource_types: Optional[List[str]] = None, @@ -4980,6 +5021,9 @@ def __init__( :keyword snapshot_volumes: Gets or sets the volume snapshot property. This property if enabled will take volume snapshots during backup. Required. :paramtype snapshot_volumes: bool + :keyword included_volume_types: Gets or sets the include volume types property. This property + sets the volume types to be included during backup. + :paramtype included_volume_types: list[str or ~azure.mgmt.dataprotection.models.AKSVolumeTypes] :keyword include_cluster_scope_resources: Gets or sets the include cluster resources property. This property if enabled will include cluster scope resources during backup. Required. :paramtype include_cluster_scope_resources: bool @@ -5006,6 +5050,7 @@ def __init__( super().__init__(**kwargs) self.object_type: str = "KubernetesClusterBackupDatasourceParameters" self.snapshot_volumes = snapshot_volumes + self.included_volume_types = included_volume_types self.include_cluster_scope_resources = include_cluster_scope_resources self.included_namespaces = included_namespaces self.excluded_namespaces = excluded_namespaces @@ -5015,7 +5060,7 @@ def __init__( self.backup_hook_references = backup_hook_references -class KubernetesClusterRestoreCriteria(ItemLevelRestoreCriteria): # pylint: disable=too-many-instance-attributes +class KubernetesClusterRestoreCriteria(ItemLevelRestoreCriteria): """kubernetes Cluster Backup target info for restore operation. All required parameters must be populated in order to send to server. @@ -5150,9 +5195,7 @@ def __init__( self.resource_modifier_reference = resource_modifier_reference -class KubernetesClusterVaultTierRestoreCriteria( - ItemLevelRestoreCriteria -): # pylint: disable=too-many-instance-attributes,name-too-long +class KubernetesClusterVaultTierRestoreCriteria(ItemLevelRestoreCriteria): # pylint: disable=name-too-long """kubernetes Cluster Backup target info for restore operation from vault. All required parameters must be populated in order to send to server. @@ -7569,6 +7612,32 @@ def __init__(self, *, backup_instance: "_models.BackupInstance", **kwargs: Any) self.backup_instance = backup_instance +class ValidateForModifyBackupRequest(_serialization.Model): + """Validate for modify backup request. + + All required parameters must be populated in order to send to server. + + :ivar backup_instance: Backup Instance. Required. + :vartype backup_instance: ~azure.mgmt.dataprotection.models.BackupInstance + """ + + _validation = { + "backup_instance": {"required": True}, + } + + _attribute_map = { + "backup_instance": {"key": "backupInstance", "type": "BackupInstance"}, + } + + def __init__(self, *, backup_instance: "_models.BackupInstance", **kwargs: Any) -> None: + """ + :keyword backup_instance: Backup Instance. Required. + :paramtype backup_instance: ~azure.mgmt.dataprotection.models.BackupInstance + """ + super().__init__(**kwargs) + self.backup_instance = backup_instance + + class ValidateRestoreRequestObject(_serialization.Model): """Validate restore request object. diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/__init__.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/__init__.py index 42904f5f3feb..7e3278153c5e 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/__init__.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/__init__.py @@ -5,32 +5,38 @@ # 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_vaults_operations import BackupVaultsOperations -from ._operation_result_operations import OperationResultOperations -from ._operation_status_operations import OperationStatusOperations -from ._operation_status_backup_vault_context_operations import OperationStatusBackupVaultContextOperations -from ._operation_status_resource_group_context_operations import OperationStatusResourceGroupContextOperations -from ._backup_vault_operation_results_operations import BackupVaultOperationResultsOperations -from ._data_protection_operations import DataProtectionOperations -from ._data_protection_operations_operations import DataProtectionOperationsOperations -from ._backup_policies_operations import BackupPoliciesOperations -from ._backup_instances_operations import BackupInstancesOperations -from ._recovery_points_operations import RecoveryPointsOperations -from ._fetch_secondary_recovery_points_operations import FetchSecondaryRecoveryPointsOperations -from ._fetch_cross_region_restore_job_operations import FetchCrossRegionRestoreJobOperations -from ._fetch_cross_region_restore_jobs_operations import FetchCrossRegionRestoreJobsOperations -from ._backup_instances_extension_routing_operations import BackupInstancesExtensionRoutingOperations -from ._jobs_operations import JobsOperations -from ._restorable_time_ranges_operations import RestorableTimeRangesOperations -from ._export_jobs_operations import ExportJobsOperations -from ._export_jobs_operation_result_operations import ExportJobsOperationResultOperations -from ._deleted_backup_instances_operations import DeletedBackupInstancesOperations -from ._resource_guards_operations import ResourceGuardsOperations -from ._dpp_resource_guard_proxy_operations import DppResourceGuardProxyOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._backup_vaults_operations import BackupVaultsOperations # type: ignore +from ._operation_result_operations import OperationResultOperations # type: ignore +from ._operation_status_operations import OperationStatusOperations # type: ignore +from ._operation_status_backup_vault_context_operations import OperationStatusBackupVaultContextOperations # type: ignore +from ._operation_status_resource_group_context_operations import OperationStatusResourceGroupContextOperations # type: ignore +from ._backup_vault_operation_results_operations import BackupVaultOperationResultsOperations # type: ignore +from ._data_protection_operations import DataProtectionOperations # type: ignore +from ._data_protection_operations_operations import DataProtectionOperationsOperations # type: ignore +from ._backup_policies_operations import BackupPoliciesOperations # type: ignore +from ._backup_instances_operations import BackupInstancesOperations # type: ignore +from ._recovery_points_operations import RecoveryPointsOperations # type: ignore +from ._fetch_secondary_recovery_points_operations import FetchSecondaryRecoveryPointsOperations # type: ignore +from ._fetch_cross_region_restore_job_operations import FetchCrossRegionRestoreJobOperations # type: ignore +from ._fetch_cross_region_restore_jobs_operations import FetchCrossRegionRestoreJobsOperations # type: ignore +from ._backup_instances_extension_routing_operations import BackupInstancesExtensionRoutingOperations # type: ignore +from ._jobs_operations import JobsOperations # type: ignore +from ._restorable_time_ranges_operations import RestorableTimeRangesOperations # type: ignore +from ._export_jobs_operations import ExportJobsOperations # type: ignore +from ._export_jobs_operation_result_operations import ExportJobsOperationResultOperations # type: ignore +from ._deleted_backup_instances_operations import DeletedBackupInstancesOperations # type: ignore +from ._resource_guards_operations import ResourceGuardsOperations # type: ignore +from ._dpp_resource_guard_proxy_operations import DppResourceGuardProxyOperations # 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__ = [ @@ -57,5 +63,5 @@ "ResourceGuardsOperations", "DppResourceGuardProxyOperations", ] -__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/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_instances_extension_routing_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_instances_extension_routing_operations.py index 14b3647df5c9..fc8ff51ceb7f 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_instances_extension_routing_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_instances_extension_routing_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,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +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 # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +42,7 @@ def build_list_request(resource_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -102,7 +99,7 @@ def list(self, resource_id: str, **kwargs: Any) -> Iterable["_models.BackupInsta api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BackupInstanceResourceList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -119,7 +116,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -135,7 +131,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/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_instances_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_instances_operations.py index 1f6a952487cf..3e65e74e1674 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_instances_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_instances_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged 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 @@ -31,12 +32,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 # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,7 +48,7 @@ def build_list_request(resource_group_name: str, vault_name: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -81,7 +81,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -121,7 +121,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -168,7 +168,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -206,7 +206,7 @@ def build_adhoc_backup_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -243,7 +243,7 @@ def build_validate_for_backup_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -273,6 +273,45 @@ def build_validate_for_backup_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) +def build_validate_for_modify_backup_request( + resource_group_name: str, vault_name: str, backup_instance_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/validateForModifyBackup", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vaultName": _SERIALIZER.url( + "vault_name", vault_name, "str", max_length=50, min_length=2, pattern=r"^[A-Za-z][-A-Za-z0-9]*[A-Za-z0-9]$" + ), + "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + def build_get_backup_instance_operation_result_request( # pylint: disable=name-too-long resource_group_name: str, vault_name: str, @@ -284,7 +323,7 @@ def build_get_backup_instance_operation_result_request( # pylint: disable=name- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -319,7 +358,7 @@ def build_trigger_cross_region_restore_request( # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -355,7 +394,7 @@ def build_validate_cross_region_restore_request( # pylint: disable=name-too-lon _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -391,7 +430,7 @@ def build_trigger_rehydrate_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -434,7 +473,7 @@ def build_trigger_restore_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -475,7 +514,7 @@ def build_resume_backups_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -509,7 +548,7 @@ def build_resume_protection_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -549,7 +588,7 @@ def build_stop_protection_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -596,7 +635,7 @@ def build_suspend_backups_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -637,7 +676,7 @@ def build_sync_backup_instance_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -674,7 +713,7 @@ def build_validate_for_restore_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -746,7 +785,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BackupInstanceResourceList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -765,7 +804,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -781,7 +819,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 @@ -827,7 +864,7 @@ def get( :rtype: ~azure.mgmt.dataprotection.models.BackupInstanceResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -850,7 +887,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -864,7 +900,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("BackupInstanceResource", pipeline_response) + deserialized = self._deserialize("BackupInstanceResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -879,8 +915,8 @@ def _create_or_update_initial( parameters: Union[_models.BackupInstanceResource, IO[bytes]], x_ms_authorization_auxiliary: Optional[str] = None, **kwargs: Any - ) -> Optional[_models.BackupInstanceResource]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -893,7 +929,7 @@ def _create_or_update_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.BackupInstanceResource]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -916,10 +952,10 @@ def _create_or_update_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 ) @@ -927,23 +963,22 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 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("BackupInstanceResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("BackupInstanceResource", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Azure-AsyncOperation"] = self._deserialize( "str", response.headers.get("Azure-AsyncOperation") ) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1069,10 +1104,11 @@ def begin_create_or_update( 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("BackupInstanceResource", pipeline_response) + deserialized = self._deserialize("BackupInstanceResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1094,15 +1130,15 @@ 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, resource_group_name: str, vault_name: str, backup_instance_name: str, x_ms_authorization_auxiliary: Optional[str] = None, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1114,7 +1150,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( resource_group_name=resource_group_name, @@ -1126,10 +1162,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 ) @@ -1137,6 +1173,10 @@ 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) @@ -1148,8 +1188,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements ) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -1184,7 +1228,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( resource_group_name=resource_group_name, vault_name=vault_name, backup_instance_name=backup_instance_name, @@ -1195,6 +1239,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 @@ -1223,8 +1268,8 @@ def _adhoc_backup_initial( backup_instance_name: str, parameters: Union[_models.TriggerBackupRequest, IO[bytes]], **kwargs: Any - ) -> Optional[_models.OperationJobExtendedInfo]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1237,7 +1282,7 @@ def _adhoc_backup_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.OperationJobExtendedInfo]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1259,10 +1304,10 @@ def _adhoc_backup_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 ) @@ -1270,14 +1315,14 @@ def _adhoc_backup_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("OperationJobExtendedInfo", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Azure-AsyncOperation"] = self._deserialize( @@ -1285,6 +1330,8 @@ def _adhoc_backup_initial( ) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1403,10 +1450,11 @@ def begin_adhoc_backup( 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("OperationJobExtendedInfo", pipeline_response) + deserialized = self._deserialize("OperationJobExtendedInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1436,8 +1484,8 @@ def _validate_for_backup_initial( vault_name: str, parameters: Union[_models.ValidateForBackupRequest, IO[bytes]], **kwargs: Any - ) -> Optional[_models.OperationJobExtendedInfo]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1450,7 +1498,7 @@ def _validate_for_backup_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.OperationJobExtendedInfo]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1471,10 +1519,10 @@ def _validate_for_backup_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 ) @@ -1482,14 +1530,14 @@ def _validate_for_backup_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("OperationJobExtendedInfo", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Azure-AsyncOperation"] = self._deserialize( @@ -1497,6 +1545,8 @@ def _validate_for_backup_initial( ) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1605,10 +1655,11 @@ def begin_validate_for_backup( 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("OperationJobExtendedInfo", pipeline_response) + deserialized = self._deserialize("OperationJobExtendedInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1632,6 +1683,213 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) + def _validate_for_modify_backup_initial( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: Union[_models.ValidateForModifyBackupRequest, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ValidateForModifyBackupRequest") + + _request = build_validate_for_modify_backup_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_validate_for_modify_backup( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: _models.ValidateForModifyBackupRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Validate whether update for backup instance will be successful or not. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the backup instance. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.ValidateForModifyBackupRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_validate_for_modify_backup( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Validate whether update for backup instance will be successful or not. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the backup instance. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_validate_for_modify_backup( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: Union[_models.ValidateForModifyBackupRequest, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Validate whether update for backup instance will be successful or not. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the backup instance. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Is either a ValidateForModifyBackupRequest type + or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.dataprotection.models.ValidateForModifyBackupRequest or IO[bytes] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + 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) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + 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._validate_for_modify_backup_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + 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 + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + @distributed_trace def get_backup_instance_operation_result( self, resource_group_name: str, vault_name: str, backup_instance_name: str, operation_id: str, **kwargs: Any @@ -1651,7 +1909,7 @@ def get_backup_instance_operation_result( :rtype: ~azure.mgmt.dataprotection.models.BackupInstanceResource or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1675,7 +1933,6 @@ def get_backup_instance_operation_result( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1691,7 +1948,7 @@ def get_backup_instance_operation_result( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("BackupInstanceResource", pipeline_response) + deserialized = self._deserialize("BackupInstanceResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1704,8 +1961,8 @@ def _trigger_cross_region_restore_initial( location: str, parameters: Union[_models.CrossRegionRestoreRequestObject, IO[bytes]], **kwargs: Any - ) -> Optional[_models.OperationJobExtendedInfo]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1718,7 +1975,7 @@ def _trigger_cross_region_restore_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.OperationJobExtendedInfo]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1739,10 +1996,10 @@ def _trigger_cross_region_restore_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 ) @@ -1750,15 +2007,15 @@ def _trigger_cross_region_restore_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) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("OperationJobExtendedInfo", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Azure-AsyncOperation"] = self._deserialize( @@ -1766,6 +2023,8 @@ def _trigger_cross_region_restore_initial( ) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1875,10 +2134,11 @@ def begin_trigger_cross_region_restore( 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("OperationJobExtendedInfo", pipeline_response) + deserialized = self._deserialize("OperationJobExtendedInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1908,8 +2168,8 @@ def _validate_cross_region_restore_initial( location: str, parameters: Union[_models.ValidateCrossRegionRestoreRequestObject, IO[bytes]], **kwargs: Any - ) -> Optional[_models.OperationJobExtendedInfo]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1922,7 +2182,7 @@ def _validate_cross_region_restore_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.OperationJobExtendedInfo]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1943,10 +2203,10 @@ def _validate_cross_region_restore_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 ) @@ -1954,15 +2214,15 @@ def _validate_cross_region_restore_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) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("OperationJobExtendedInfo", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Azure-AsyncOperation"] = self._deserialize( @@ -1970,6 +2230,8 @@ def _validate_cross_region_restore_initial( ) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -2079,10 +2341,11 @@ def begin_validate_cross_region_restore( 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("OperationJobExtendedInfo", pipeline_response) + deserialized = self._deserialize("OperationJobExtendedInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -2106,15 +2369,15 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _trigger_rehydrate_initial( # pylint: disable=inconsistent-return-statements + def _trigger_rehydrate_initial( self, resource_group_name: str, vault_name: str, backup_instance_name: str, parameters: Union[_models.AzureBackupRehydrationRequest, IO[bytes]], **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2127,7 +2390,7 @@ def _trigger_rehydrate_initial( # pylint: disable=inconsistent-return-statement 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 @@ -2149,10 +2412,10 @@ def _trigger_rehydrate_initial( # pylint: disable=inconsistent-return-statement 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 ) @@ -2160,6 +2423,10 @@ def _trigger_rehydrate_initial( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [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) @@ -2171,8 +2438,12 @@ def _trigger_rehydrate_initial( # pylint: disable=inconsistent-return-statement ) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @overload def begin_trigger_rehydrate( @@ -2269,7 +2540,7 @@ def begin_trigger_rehydrate( 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_rehydrate_initial( # type: ignore + raw_result = self._trigger_rehydrate_initial( resource_group_name=resource_group_name, vault_name=vault_name, backup_instance_name=backup_instance_name, @@ -2281,6 +2552,7 @@ def begin_trigger_rehydrate( 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 @@ -2310,8 +2582,8 @@ def _trigger_restore_initial( parameters: Union[_models.AzureBackupRestoreRequest, IO[bytes]], x_ms_authorization_auxiliary: Optional[str] = None, **kwargs: Any - ) -> Optional[_models.OperationJobExtendedInfo]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2324,7 +2596,7 @@ def _trigger_restore_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.OperationJobExtendedInfo]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2347,10 +2619,10 @@ def _trigger_restore_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 ) @@ -2358,14 +2630,14 @@ def _trigger_restore_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("OperationJobExtendedInfo", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Azure-AsyncOperation"] = self._deserialize( @@ -2373,6 +2645,8 @@ def _trigger_restore_initial( ) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -2501,10 +2775,11 @@ def begin_trigger_restore( 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("OperationJobExtendedInfo", pipeline_response) + deserialized = self._deserialize("OperationJobExtendedInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -2528,10 +2803,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _resume_backups_initial( # pylint: disable=inconsistent-return-statements + def _resume_backups_initial( self, resource_group_name: str, vault_name: str, backup_instance_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2543,7 +2818,7 @@ def _resume_backups_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_resume_backups_request( resource_group_name=resource_group_name, @@ -2554,10 +2829,10 @@ def _resume_backups_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 ) @@ -2565,6 +2840,10 @@ def _resume_backups_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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2576,8 +2855,12 @@ def _resume_backups_initial( # pylint: disable=inconsistent-return-statements ) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_resume_backups( @@ -2605,7 +2888,7 @@ def begin_resume_backups( 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._resume_backups_initial( # type: ignore + raw_result = self._resume_backups_initial( resource_group_name=resource_group_name, vault_name=vault_name, backup_instance_name=backup_instance_name, @@ -2615,6 +2898,7 @@ def begin_resume_backups( 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 @@ -2636,10 +2920,10 @@ 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 _resume_protection_initial( # pylint: disable=inconsistent-return-statements + def _resume_protection_initial( self, resource_group_name: str, vault_name: str, backup_instance_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2651,7 +2935,7 @@ def _resume_protection_initial( # pylint: disable=inconsistent-return-statement _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_resume_protection_request( resource_group_name=resource_group_name, @@ -2662,10 +2946,10 @@ def _resume_protection_initial( # pylint: disable=inconsistent-return-statement 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 ) @@ -2673,6 +2957,10 @@ def _resume_protection_initial( # pylint: disable=inconsistent-return-statement 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) @@ -2684,8 +2972,12 @@ def _resume_protection_initial( # pylint: disable=inconsistent-return-statement ) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_resume_protection( @@ -2713,7 +3005,7 @@ def begin_resume_protection( 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._resume_protection_initial( # type: ignore + raw_result = self._resume_protection_initial( resource_group_name=resource_group_name, vault_name=vault_name, backup_instance_name=backup_instance_name, @@ -2723,6 +3015,7 @@ def begin_resume_protection( 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 @@ -2744,7 +3037,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 _stop_protection_initial( # pylint: disable=inconsistent-return-statements + def _stop_protection_initial( self, resource_group_name: str, vault_name: str, @@ -2752,8 +3045,8 @@ def _stop_protection_initial( # pylint: disable=inconsistent-return-statements x_ms_authorization_auxiliary: Optional[str] = None, parameters: Optional[Union[_models.StopProtectionRequest, IO[bytes]]] = None, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2766,7 +3059,7 @@ def _stop_protection_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 @@ -2792,10 +3085,10 @@ def _stop_protection_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 ) @@ -2803,6 +3096,10 @@ def _stop_protection_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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2814,8 +3111,12 @@ def _stop_protection_initial( # pylint: disable=inconsistent-return-statements ) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @overload def begin_stop_protection( @@ -2921,7 +3222,7 @@ def begin_stop_protection( 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._stop_protection_initial( # type: ignore + raw_result = self._stop_protection_initial( resource_group_name=resource_group_name, vault_name=vault_name, backup_instance_name=backup_instance_name, @@ -2934,6 +3235,7 @@ def begin_stop_protection( 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 @@ -2955,7 +3257,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 _suspend_backups_initial( # pylint: disable=inconsistent-return-statements + def _suspend_backups_initial( self, resource_group_name: str, vault_name: str, @@ -2963,8 +3265,8 @@ def _suspend_backups_initial( # pylint: disable=inconsistent-return-statements x_ms_authorization_auxiliary: Optional[str] = None, parameters: Optional[Union[_models.SuspendBackupRequest, IO[bytes]]] = None, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2977,7 +3279,7 @@ def _suspend_backups_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 @@ -3003,10 +3305,10 @@ def _suspend_backups_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 ) @@ -3014,6 +3316,10 @@ def _suspend_backups_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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -3025,8 +3331,12 @@ def _suspend_backups_initial( # pylint: disable=inconsistent-return-statements ) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @overload def begin_suspend_backups( @@ -3135,7 +3445,7 @@ def begin_suspend_backups( 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._suspend_backups_initial( # type: ignore + raw_result = self._suspend_backups_initial( resource_group_name=resource_group_name, vault_name=vault_name, backup_instance_name=backup_instance_name, @@ -3148,6 +3458,7 @@ def begin_suspend_backups( 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 @@ -3169,15 +3480,15 @@ 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 _sync_backup_instance_initial( # pylint: disable=inconsistent-return-statements + def _sync_backup_instance_initial( self, resource_group_name: str, vault_name: str, backup_instance_name: str, parameters: Union[_models.SyncBackupInstanceRequest, IO[bytes]], **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3190,7 +3501,7 @@ def _sync_backup_instance_initial( # pylint: disable=inconsistent-return-statem 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 @@ -3212,10 +3523,10 @@ def _sync_backup_instance_initial( # pylint: disable=inconsistent-return-statem 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 ) @@ -3223,6 +3534,10 @@ def _sync_backup_instance_initial( # pylint: disable=inconsistent-return-statem 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) @@ -3234,8 +3549,12 @@ def _sync_backup_instance_initial( # pylint: disable=inconsistent-return-statem ) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @overload def begin_sync_backup_instance( @@ -3335,7 +3654,7 @@ def begin_sync_backup_instance( 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._sync_backup_instance_initial( # type: ignore + raw_result = self._sync_backup_instance_initial( resource_group_name=resource_group_name, vault_name=vault_name, backup_instance_name=backup_instance_name, @@ -3347,6 +3666,7 @@ def begin_sync_backup_instance( 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 @@ -3375,8 +3695,8 @@ def _validate_for_restore_initial( backup_instance_name: str, parameters: Union[_models.ValidateRestoreRequestObject, IO[bytes]], **kwargs: Any - ) -> Optional[_models.OperationJobExtendedInfo]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3389,7 +3709,7 @@ def _validate_for_restore_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.OperationJobExtendedInfo]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -3411,10 +3731,10 @@ def _validate_for_restore_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 ) @@ -3422,14 +3742,14 @@ def _validate_for_restore_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("OperationJobExtendedInfo", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Azure-AsyncOperation"] = self._deserialize( @@ -3437,6 +3757,8 @@ def _validate_for_restore_initial( ) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -3555,10 +3877,11 @@ def begin_validate_for_restore( 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("OperationJobExtendedInfo", pipeline_response) + deserialized = self._deserialize("OperationJobExtendedInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_policies_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_policies_operations.py index 5141ece71cca..f0518f95bca1 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_policies_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/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. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +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 # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,7 +43,7 @@ def build_list_request(resource_group_name: str, vault_name: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -79,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -113,7 +110,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -150,7 +147,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -220,7 +217,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BaseBackupPolicyResourceList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -239,7 +236,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -255,7 +251,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 @@ -303,7 +298,7 @@ def get( :rtype: ~azure.mgmt.dataprotection.models.BaseBackupPolicyResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -326,7 +321,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -340,7 +334,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("BaseBackupPolicyResource", pipeline_response) + deserialized = self._deserialize("BaseBackupPolicyResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -438,7 +432,7 @@ def create_or_update( :rtype: ~azure.mgmt.dataprotection.models.BaseBackupPolicyResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -473,7 +467,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -487,7 +480,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("BaseBackupPolicyResource", pipeline_response) + deserialized = self._deserialize("BaseBackupPolicyResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -513,7 +506,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -536,7 +529,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/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_vault_operation_results_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_vault_operation_results_operations.py index c8bc2ca2e2e8..4374348c8862 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_vault_operation_results_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_vault_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. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,20 +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 # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +42,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +106,7 @@ def get( :rtype: ~azure.mgmt.dataprotection.models.BackupVaultResource or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -132,7 +129,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -149,7 +145,7 @@ def get( deserialized = None response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("BackupVaultResource", pipeline_response) + deserialized = self._deserialize("BackupVaultResource", pipeline_response.http_response) if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_vaults_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_vaults_operations.py index e8f0a8b9bf40..66c6588f2eec 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_vaults_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_vaults_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged 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 @@ -31,12 +32,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 # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,7 +48,7 @@ def build_get_in_subscription_request(subscription_id: str, **kwargs: Any) -> Ht _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72,7 +72,7 @@ def build_get_in_resource_group_request(resource_group_name: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -102,7 +102,7 @@ def build_get_request(resource_group_name: str, vault_name: str, subscription_id _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -140,7 +140,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -178,7 +178,7 @@ def build_delete_request(resource_group_name: str, vault_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -216,7 +216,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -256,7 +256,7 @@ def build_check_name_availability_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -319,7 +319,7 @@ def get_in_subscription(self, **kwargs: Any) -> Iterable["_models.BackupVaultRes api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BackupVaultResourceList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -336,7 +336,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -352,7 +351,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 @@ -398,7 +396,7 @@ def get_in_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iter api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BackupVaultResourceList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -416,7 +414,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -432,7 +429,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 @@ -474,7 +470,7 @@ def get(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> _mode :rtype: ~azure.mgmt.dataprotection.models.BackupVaultResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -496,7 +492,6 @@ def get(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> _mode headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -510,7 +505,7 @@ def get(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> _mode map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupVaultResource", pipeline_response) + deserialized = self._deserialize("BackupVaultResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -524,8 +519,8 @@ def _create_or_update_initial( parameters: Union[_models.BackupVaultResource, IO[bytes]], x_ms_authorization_auxiliary: Optional[str] = None, **kwargs: Any - ) -> _models.BackupVaultResource: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -538,7 +533,7 @@ def _create_or_update_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.BackupVaultResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -560,10 +555,10 @@ def _create_or_update_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 ) @@ -571,14 +566,14 @@ def _create_or_update_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("BackupVaultResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("BackupVaultResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -695,10 +690,11 @@ def begin_create_or_update( 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("BackupVaultResource", pipeline_response) + deserialized = self._deserialize("BackupVaultResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -720,10 +716,8 @@ 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 - self, resource_group_name: str, vault_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + def _delete_initial(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -735,7 +729,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( resource_group_name=resource_group_name, @@ -745,10 +739,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 ) @@ -756,11 +750,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(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> LROPoller[None]: @@ -784,7 +786,7 @@ def begin_delete(self, resource_group_name: str, vault_name: str, **kwargs: Any) 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( resource_group_name=resource_group_name, vault_name=vault_name, api_version=api_version, @@ -793,6 +795,7 @@ def begin_delete(self, resource_group_name: str, vault_name: str, **kwargs: Any) 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 @@ -821,8 +824,8 @@ def _update_initial( parameters: Union[_models.PatchResourceRequestInput, IO[bytes]], x_ms_authorization_auxiliary: Optional[str] = None, **kwargs: Any - ) -> Optional[_models.BackupVaultResource]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -835,7 +838,7 @@ def _update_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.BackupVaultResource]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -857,10 +860,10 @@ def _update_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 ) @@ -868,12 +871,14 @@ def _update_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("BackupVaultResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -993,10 +998,11 @@ def begin_update( 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("BackupVaultResource", pipeline_response) + deserialized = self._deserialize("BackupVaultResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1100,7 +1106,7 @@ def check_name_availability( :rtype: ~azure.mgmt.dataprotection.models.CheckNameAvailabilityResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1134,7 +1140,6 @@ def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1148,7 +1153,7 @@ def check_name_availability( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_data_protection_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_data_protection_operations.py index 301cd0a52ac5..bc4d061ef91b 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_data_protection_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_data_protection_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +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 # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -44,7 +41,7 @@ def build_check_feature_support_request(location: str, subscription_id: str, **k _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -152,7 +149,7 @@ def check_feature_support( :rtype: ~azure.mgmt.dataprotection.models.FeatureValidationResponseBase :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -185,7 +182,6 @@ def check_feature_support( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -199,7 +195,7 @@ def check_feature_support( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FeatureValidationResponseBase", pipeline_response) + deserialized = self._deserialize("FeatureValidationResponseBase", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_data_protection_operations_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_data_protection_operations_operations.py index 7c4061c585db..2cd10b47d99f 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_data_protection_operations_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_data_protection_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. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +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 # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +42,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95,7 +92,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: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -111,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: @@ -127,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/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_deleted_backup_instances_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_deleted_backup_instances_operations.py index f0fa3634eb25..e887c38d9752 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_deleted_backup_instances_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_deleted_backup_instances_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,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar, Union, cast +from typing import Any, Callable, Dict, Iterable, Iterator, Optional, TypeVar, Union, cast import urllib.parse from azure.core.exceptions import ( @@ -16,13 +15,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged 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 @@ -30,12 +30,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 # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +46,7 @@ def build_list_request(resource_group_name: str, vault_name: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -80,7 +79,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -114,7 +113,7 @@ def build_undelete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -184,7 +183,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DeletedBackupInstanceResourceList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -203,7 +202,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -219,7 +217,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 +262,7 @@ def get( :rtype: ~azure.mgmt.dataprotection.models.DeletedBackupInstanceResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -288,7 +285,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -302,17 +298,17 @@ 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("DeletedBackupInstanceResource", pipeline_response) + deserialized = self._deserialize("DeletedBackupInstanceResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _undelete_initial( # pylint: disable=inconsistent-return-statements + def _undelete_initial( self, resource_group_name: str, vault_name: str, backup_instance_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -324,7 +320,7 @@ def _undelete_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_undelete_request( resource_group_name=resource_group_name, @@ -335,10 +331,10 @@ def _undelete_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 ) @@ -346,11 +342,19 @@ def _undelete_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) 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_undelete( @@ -378,7 +382,7 @@ def begin_undelete( 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._undelete_initial( # type: ignore + raw_result = self._undelete_initial( resource_group_name=resource_group_name, vault_name=vault_name, backup_instance_name=backup_instance_name, @@ -388,6 +392,7 @@ def begin_undelete( 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/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_dpp_resource_guard_proxy_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_dpp_resource_guard_proxy_operations.py index 96eefbc265d5..efe73574cba7 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_dpp_resource_guard_proxy_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_dpp_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. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +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 # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,7 +43,7 @@ def build_list_request(resource_group_name: str, vault_name: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -79,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -115,7 +112,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -154,7 +151,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -196,7 +193,7 @@ def build_unlock_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -277,7 +274,7 @@ def list( 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: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -296,7 +293,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -312,7 +308,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 @@ -362,7 +357,7 @@ def get( :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -385,7 +380,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -399,7 +393,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 @@ -497,7 +491,7 @@ def create_or_update( :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -532,7 +526,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -546,7 +539,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("ResourceGuardProxyBaseResource", pipeline_response) + deserialized = self._deserialize("ResourceGuardProxyBaseResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -572,7 +565,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -595,7 +588,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 @@ -712,7 +704,7 @@ def unlock_delete( :rtype: ~azure.mgmt.dataprotection.models.UnlockDeleteResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -748,7 +740,6 @@ def unlock_delete( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -762,7 +753,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/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_export_jobs_operation_result_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_export_jobs_operation_result_operations.py index 1b6de80ef037..9b8b0b3f2d13 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_export_jobs_operation_result_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_export_jobs_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. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,20 +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 # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +42,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -111,7 +108,7 @@ def get( :rtype: ~azure.mgmt.dataprotection.models.ExportJobsResult or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -134,7 +131,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -150,7 +146,7 @@ def get( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ExportJobsResult", pipeline_response) + deserialized = self._deserialize("ExportJobsResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_export_jobs_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_export_jobs_operations.py index 8c2feeb4ad45..7270d4dccf87 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_export_jobs_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_export_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,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union, cast +from typing import Any, Callable, Dict, Iterator, Optional, TypeVar, Union, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,12 +14,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,12 +28,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 # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +46,7 @@ def build_trigger_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,10 +92,8 @@ 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 - self, resource_group_name: str, vault_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + def _trigger_initial(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -108,7 +105,7 @@ def _trigger_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_trigger_request( resource_group_name=resource_group_name, @@ -118,10 +115,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 ) @@ -129,6 +126,10 @@ def _trigger_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [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) @@ -137,8 +138,12 @@ def _trigger_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_trigger(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> LROPoller[None]: @@ -162,7 +167,7 @@ def begin_trigger(self, resource_group_name: str, vault_name: str, **kwargs: Any 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( resource_group_name=resource_group_name, vault_name=vault_name, api_version=api_version, @@ -171,6 +176,7 @@ def begin_trigger(self, resource_group_name: str, vault_name: str, **kwargs: Any 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/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_fetch_cross_region_restore_job_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_fetch_cross_region_restore_job_operations.py index 9bddc23fd1ed..acb867e30bd9 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_fetch_cross_region_restore_job_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_fetch_cross_region_restore_job_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +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 # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -44,7 +41,7 @@ def build_get_request(resource_group_name: str, location: str, subscription_id: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -169,7 +166,7 @@ def get( :rtype: ~azure.mgmt.dataprotection.models.AzureBackupJobResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -203,7 +200,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -217,7 +213,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("AzureBackupJobResource", pipeline_response) + deserialized = self._deserialize("AzureBackupJobResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_fetch_cross_region_restore_jobs_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_fetch_cross_region_restore_jobs_operations.py index 6f8b3bb2a29b..71e3f5279c51 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_fetch_cross_region_restore_jobs_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_fetch_cross_region_restore_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. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +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 # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,7 +45,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -194,7 +191,7 @@ def list( content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AzureBackupJobResourceList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -224,7 +221,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -240,7 +236,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/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_fetch_secondary_recovery_points_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_fetch_secondary_recovery_points_operations.py index 6778813c4e59..6a256c99ef0f 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_fetch_secondary_recovery_points_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_fetch_secondary_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. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +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 # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -54,7 +51,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -218,7 +215,7 @@ def list( content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AzureBackupRecoveryPointResourceList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -249,7 +246,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -265,7 +261,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/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_jobs_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_jobs_operations.py index 111ce0426601..57e2ff895c5a 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_jobs_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/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. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +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 # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +42,7 @@ def build_list_request(resource_group_name: str, vault_name: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +75,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -147,7 +144,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AzureBackupJobResourceList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -166,7 +163,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -182,7 +178,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 @@ -229,7 +224,7 @@ def get( :rtype: ~azure.mgmt.dataprotection.models.AzureBackupJobResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -252,7 +247,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -266,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("AzureBackupJobResource", pipeline_response) + deserialized = self._deserialize("AzureBackupJobResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_result_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_result_operations.py index 4e3a69cc6332..f3e844b31336 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_result_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_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. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,20 +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 # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +40,7 @@ def build_get_request(operation_id: str, location: str, subscription_id: str, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -101,7 +98,7 @@ def get(self, operation_id: str, location: str, **kwargs: Any) -> Optional[_mode :rtype: ~azure.mgmt.dataprotection.models.OperationJobExtendedInfo or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -123,7 +120,6 @@ def get(self, operation_id: str, location: str, **kwargs: Any) -> Optional[_mode headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -140,7 +136,7 @@ def get(self, operation_id: str, location: str, **kwargs: Any) -> Optional[_mode deserialized = None response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("OperationJobExtendedInfo", pipeline_response) + deserialized = self._deserialize("OperationJobExtendedInfo", pipeline_response.http_response) if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_status_backup_vault_context_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_status_backup_vault_context_operations.py index 1e9463a7c217..d07ca03c3e19 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_status_backup_vault_context_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_status_backup_vault_context_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,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,20 +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 # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +42,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -111,7 +108,7 @@ def get( :rtype: ~azure.mgmt.dataprotection.models.OperationResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -134,7 +131,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -148,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("OperationResource", pipeline_response) + deserialized = self._deserialize("OperationResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_status_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_status_operations.py index 4333b1e72830..47c19deee6a2 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_status_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_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. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,20 +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 # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +40,7 @@ def build_get_request(location: str, operation_id: str, subscription_id: str, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -101,7 +98,7 @@ def get(self, location: str, operation_id: str, **kwargs: Any) -> _models.Operat :rtype: ~azure.mgmt.dataprotection.models.OperationResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -123,7 +120,6 @@ def get(self, location: str, operation_id: str, **kwargs: Any) -> _models.Operat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -137,7 +133,7 @@ def get(self, location: str, operation_id: str, **kwargs: Any) -> _models.Operat map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("OperationResource", pipeline_response) + deserialized = self._deserialize("OperationResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_status_resource_group_context_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_status_resource_group_context_operations.py index c2c577d3b0bf..d78de2baa391 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_status_resource_group_context_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_status_resource_group_context_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,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,20 +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 # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +40,7 @@ def build_get_request(resource_group_name: str, operation_id: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -104,7 +101,7 @@ def get(self, resource_group_name: str, operation_id: str, **kwargs: Any) -> _mo :rtype: ~azure.mgmt.dataprotection.models.OperationResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -126,7 +123,6 @@ def get(self, resource_group_name: str, operation_id: str, **kwargs: Any) -> _mo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -140,7 +136,7 @@ def get(self, resource_group_name: str, operation_id: str, **kwargs: Any) -> _mo map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("OperationResource", pipeline_response) + deserialized = self._deserialize("OperationResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_recovery_points_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_recovery_points_operations.py index b1dd46031ec5..73a95c30cb2d 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_recovery_points_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/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,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +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 # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -54,7 +51,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +94,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -180,7 +177,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AzureBackupRecoveryPointResourceList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -202,7 +199,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 +214,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 @@ -271,7 +266,7 @@ def get( :rtype: ~azure.mgmt.dataprotection.models.AzureBackupRecoveryPointResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -295,7 +290,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -309,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("AzureBackupRecoveryPointResource", pipeline_response) + deserialized = self._deserialize("AzureBackupRecoveryPointResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_resource_guards_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_resource_guards_operations.py index 4f9e23ff3c5d..6c90de022550 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_resource_guards_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_resource_guards_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +21,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 # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,7 +46,7 @@ def build_get_resources_in_subscription_request( # pylint: disable=name-too-lon _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76,7 +74,7 @@ def build_get_resources_in_resource_group_request( # pylint: disable=name-too-l _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -108,7 +106,7 @@ def build_put_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -144,7 +142,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -177,7 +175,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -210,7 +208,7 @@ def build_patch_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -246,7 +244,7 @@ def build_get_disable_soft_delete_requests_objects_request( # pylint: disable=n _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -279,7 +277,7 @@ def build_get_delete_resource_guard_proxy_requests_objects_request( # pylint: d _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -312,7 +310,7 @@ def build_get_backup_security_pin_requests_objects_request( # pylint: disable=n _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -345,7 +343,7 @@ def build_get_delete_protected_item_requests_objects_request( # pylint: disable _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -378,7 +376,7 @@ def build_get_update_protection_policy_requests_objects_request( # pylint: disa _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -411,7 +409,7 @@ def build_get_update_protected_item_requests_objects_request( # pylint: disable _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -444,7 +442,7 @@ def build_get_default_disable_soft_delete_requests_object_request( # pylint: di _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -478,7 +476,7 @@ def build_get_default_delete_resource_guard_proxy_requests_object_request( # py _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -512,7 +510,7 @@ def build_get_default_backup_security_pin_requests_object_request( # pylint: di _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -546,7 +544,7 @@ def build_get_default_delete_protected_item_requests_object_request( # pylint: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -580,7 +578,7 @@ def build_get_default_update_protection_policy_requests_object_request( # pylin _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -614,7 +612,7 @@ def build_get_default_update_protected_item_requests_object_request( # pylint: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -678,7 +676,7 @@ def get_resources_in_subscription(self, **kwargs: Any) -> Iterable["_models.Reso api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ResourceGuardResourceList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -695,7 +693,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -711,7 +708,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 @@ -762,7 +758,7 @@ def get_resources_in_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ResourceGuardResourceList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -780,7 +776,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -796,7 +791,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 @@ -907,7 +901,7 @@ def put( :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -941,7 +935,6 @@ def put( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -955,11 +948,7 @@ def put( 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("ResourceGuardResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ResourceGuardResource", pipeline_response) + deserialized = self._deserialize("ResourceGuardResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -981,7 +970,7 @@ def get(self, resource_group_name: str, resource_guards_name: str, **kwargs: Any :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1003,7 +992,6 @@ def get(self, resource_group_name: str, resource_guards_name: str, **kwargs: Any headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1017,7 +1005,7 @@ def get(self, resource_group_name: str, resource_guards_name: str, **kwargs: Any map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceGuardResource", pipeline_response) + deserialized = self._deserialize("ResourceGuardResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1041,7 +1029,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1063,7 +1051,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 @@ -1168,7 +1155,7 @@ def patch( :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1202,7 +1189,6 @@ def patch( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1216,7 +1202,7 @@ def patch( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceGuardResource", pipeline_response) + deserialized = self._deserialize("ResourceGuardResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1248,7 +1234,7 @@ def get_disable_soft_delete_requests_objects( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DppBaseResourceList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1267,7 +1253,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1283,7 +1268,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 @@ -1337,7 +1321,7 @@ def get_delete_resource_guard_proxy_requests_objects( # pylint: disable=name-to api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DppBaseResourceList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1356,7 +1340,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1372,7 +1355,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 @@ -1426,7 +1408,7 @@ def get_backup_security_pin_requests_objects( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DppBaseResourceList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1445,7 +1427,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1461,7 +1442,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 @@ -1515,7 +1495,7 @@ def get_delete_protected_item_requests_objects( # pylint: disable=name-too-long api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DppBaseResourceList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1534,7 +1514,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1550,7 +1529,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 @@ -1604,7 +1582,7 @@ def get_update_protection_policy_requests_objects( # pylint: disable=name-too-l api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DppBaseResourceList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1623,7 +1601,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1639,7 +1616,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 @@ -1693,7 +1669,7 @@ def get_update_protected_item_requests_objects( # pylint: disable=name-too-long api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DppBaseResourceList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1712,7 +1688,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1728,7 +1703,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 @@ -1778,7 +1752,7 @@ def get_default_disable_soft_delete_requests_object( # pylint: disable=name-too :rtype: ~azure.mgmt.dataprotection.models.DppBaseResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1801,7 +1775,6 @@ def get_default_disable_soft_delete_requests_object( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1815,7 +1788,7 @@ def get_default_disable_soft_delete_requests_object( # pylint: disable=name-too map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DppBaseResource", pipeline_response) + deserialized = self._deserialize("DppBaseResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1843,7 +1816,7 @@ def get_default_delete_resource_guard_proxy_requests_object( # pylint: disable= :rtype: ~azure.mgmt.dataprotection.models.DppBaseResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1866,7 +1839,6 @@ def get_default_delete_resource_guard_proxy_requests_object( # pylint: disable= headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1880,7 +1852,7 @@ def get_default_delete_resource_guard_proxy_requests_object( # pylint: disable= map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DppBaseResource", pipeline_response) + deserialized = self._deserialize("DppBaseResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1908,7 +1880,7 @@ def get_default_backup_security_pin_requests_object( # pylint: disable=name-too :rtype: ~azure.mgmt.dataprotection.models.DppBaseResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1931,7 +1903,6 @@ def get_default_backup_security_pin_requests_object( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1945,7 +1916,7 @@ def get_default_backup_security_pin_requests_object( # pylint: disable=name-too map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DppBaseResource", pipeline_response) + deserialized = self._deserialize("DppBaseResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1973,7 +1944,7 @@ def get_default_delete_protected_item_requests_object( # pylint: disable=name-t :rtype: ~azure.mgmt.dataprotection.models.DppBaseResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1996,7 +1967,6 @@ def get_default_delete_protected_item_requests_object( # pylint: disable=name-t headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2010,7 +1980,7 @@ def get_default_delete_protected_item_requests_object( # pylint: disable=name-t map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DppBaseResource", pipeline_response) + deserialized = self._deserialize("DppBaseResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2038,7 +2008,7 @@ def get_default_update_protection_policy_requests_object( # pylint: disable=nam :rtype: ~azure.mgmt.dataprotection.models.DppBaseResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2061,7 +2031,6 @@ def get_default_update_protection_policy_requests_object( # pylint: disable=nam headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2075,7 +2044,7 @@ def get_default_update_protection_policy_requests_object( # pylint: disable=nam map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DppBaseResource", pipeline_response) + deserialized = self._deserialize("DppBaseResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2103,7 +2072,7 @@ def get_default_update_protected_item_requests_object( # pylint: disable=name-t :rtype: ~azure.mgmt.dataprotection.models.DppBaseResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2126,7 +2095,6 @@ def get_default_update_protected_item_requests_object( # pylint: disable=name-t headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2140,7 +2108,7 @@ def get_default_update_protected_item_requests_object( # pylint: disable=name-t map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DppBaseResource", pipeline_response) + deserialized = self._deserialize("DppBaseResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_restorable_time_ranges_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_restorable_time_ranges_operations.py index 06b7d1a4193e..2a1da0b7a995 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_restorable_time_ranges_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_restorable_time_ranges_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +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 # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,7 +43,7 @@ def build_find_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -182,7 +179,7 @@ def find( :rtype: ~azure.mgmt.dataprotection.models.AzureBackupFindRestorableTimeRangesResponseResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -217,7 +214,6 @@ def find( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -231,7 +227,9 @@ def find( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureBackupFindRestorableTimeRangesResponseResource", pipeline_response) + deserialized = self._deserialize( + "AzureBackupFindRestorableTimeRangesResponseResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/delete_backup_instance.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/delete_backup_instance.py index 13556bd61c23..47eef840ed6f 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/delete_backup_instance.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/delete_backup_instance.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/BackupInstanceOperations/DeleteBackupInstance.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/BackupInstanceOperations/DeleteBackupInstance.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/find_restorable_time_ranges.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/find_restorable_time_ranges.py index bc38d16427e1..ac2cab23ec5a 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/find_restorable_time_ranges.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/find_restorable_time_ranges.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.dataprotection import DataProtectionMgmtClient @@ -45,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/BackupInstanceOperations/FindRestorableTimeRanges.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/BackupInstanceOperations/FindRestorableTimeRanges.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/get_backup_instance.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/get_backup_instance.py index d17eaf2f2e03..c043ffff449b 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/get_backup_instance.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/get_backup_instance.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/BackupInstanceOperations/GetBackupInstance.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/BackupInstanceOperations/GetBackupInstance.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/get_backup_instance_adlsblob_backup_datasource_parameters.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/get_backup_instance_adlsblob_backup_datasource_parameters.py new file mode 100644 index 000000000000..d5c2c58bbcbb --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/get_backup_instance_adlsblob_backup_datasource_parameters.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# 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.dataprotection import DataProtectionMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python get_backup_instance_adlsblob_backup_datasource_parameters.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 = DataProtectionMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="54707983-993e-43de-8d94-074451394eda", + ) + + response = client.backup_instances.get( + resource_group_name="adlsrg", + vault_name="adlsvault", + backup_instance_name="adlsbackupinstance", + ) + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/BackupInstanceOperations/GetBackupInstance_ADLSBlobBackupDatasourceParameters.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/get_backup_instance_operation_result.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/get_backup_instance_operation_result.py index 8cbfa29bfad2..855f135e1267 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/get_backup_instance_operation_result.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/get_backup_instance_operation_result.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/BackupInstanceOperations/GetBackupInstanceOperationResult.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/BackupInstanceOperations/GetBackupInstanceOperationResult.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/get_recovery_point.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/get_recovery_point.py index 93e87ee1df16..123f489e8810 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/get_recovery_point.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/get_recovery_point.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/BackupInstanceOperations/GetRecoveryPoint.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/BackupInstanceOperations/GetRecoveryPoint.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/list_backup_instances.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/list_backup_instances.py index 0b57b80490a9..ce98ad10c847 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/list_backup_instances.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/list_backup_instances.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/BackupInstanceOperations/ListBackupInstances.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/BackupInstanceOperations/ListBackupInstances.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/list_backup_instances_extension_routing.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/list_backup_instances_extension_routing.py index 68687fad5281..9d59c94bb644 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/list_backup_instances_extension_routing.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/list_backup_instances_extension_routing.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/BackupInstanceOperations/ListBackupInstancesExtensionRouting.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/BackupInstanceOperations/ListBackupInstancesExtensionRouting.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/list_recovery_points.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/list_recovery_points.py index 828d96717086..088732cc2262 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/list_recovery_points.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/list_recovery_points.py @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/BackupInstanceOperations/ListRecoveryPoints.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/BackupInstanceOperations/ListRecoveryPoints.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/put_backup_instance.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/put_backup_instance.py index be62f8614e0e..b8c22750acce 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/put_backup_instance.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/put_backup_instance.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.dataprotection import DataProtectionMgmtClient @@ -85,6 +83,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/BackupInstanceOperations/PutBackupInstance.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/BackupInstanceOperations/PutBackupInstance.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/put_backup_instance_adlsblob_backup_datasource_parameters.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/put_backup_instance_adlsblob_backup_datasource_parameters.py new file mode 100644 index 000000000000..b4ad70a1bcdd --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/put_backup_instance_adlsblob_backup_datasource_parameters.py @@ -0,0 +1,76 @@ +# 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.dataprotection import DataProtectionMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python put_backup_instance_adlsblob_backup_datasource_parameters.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 = DataProtectionMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="54707983-993e-43de-8d94-074451394eda", + ) + + response = client.backup_instances.begin_create_or_update( + resource_group_name="adlsrg", + vault_name="adlsvault", + backup_instance_name="adlsstorageaccount-adlsstorageaccount-19a76f8a-c176-4f7d-819e-95157e2b0071", + parameters={ + "properties": { + "dataSourceInfo": { + "datasourceType": "Microsoft.Storage/storageAccounts/adlsBlobServices", + "objectType": "Datasource", + "resourceID": "/subscriptions/54707983-993e-43de-8d94-074451394eda/resourceGroups/adlsrg/providers/Microsoft.Storage/storageAccounts/adlsstorageaccount", + "resourceLocation": "centraluseuap", + "resourceName": "adlsstorageaccount", + "resourceType": "microsoft.storage/storageAccounts", + "resourceUri": "/subscriptions/54707983-993e-43de-8d94-074451394eda/resourceGroups/adlsrg/providers/Microsoft.Storage/storageAccounts/adlsstorageaccount", + }, + "dataSourceSetInfo": { + "datasourceType": "Microsoft.Storage/storageAccounts/adlsBlobServices", + "objectType": "DatasourceSet", + "resourceID": "/subscriptions/54707983-993e-43de-8d94-074451394eda/resourceGroups/adlsrg/providers/Microsoft.Storage/storageAccounts/adlsstorageaccount", + "resourceLocation": "centraluseuap", + "resourceName": "adlsstorageaccount", + "resourceType": "microsoft.storage/storageAccounts", + "resourceUri": "/subscriptions/54707983-993e-43de-8d94-074451394eda/resourceGroups/adlsrg/providers/Microsoft.Storage/storageAccounts/adlsstorageaccount", + }, + "friendlyName": "adlsstorageaccount\\adlsbackupinstance", + "objectType": "BackupInstance", + "policyInfo": { + "policyId": "/subscriptions/54707983-993e-43de-8d94-074451394eda/resourceGroups/adlsrg/providers/Microsoft.DataProtection/backupVaults/adlsvault/backupPolicies/adlspolicy", + "policyParameters": { + "backupDatasourceParametersList": [ + {"containersList": ["container1"], "objectType": "AdlsBlobBackupDatasourceParameters"} + ] + }, + }, + }, + "tags": {"key1": "val1"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/BackupInstanceOperations/PutBackupInstance_ADLSBlobBackupDatasourceParameters.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/put_backup_instance_kubernetes_cluster_backup_datasource_parameters.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/put_backup_instance_kubernetes_cluster_backup_datasource_parameters.py new file mode 100644 index 000000000000..d703e6b3defd --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/put_backup_instance_kubernetes_cluster_backup_datasource_parameters.py @@ -0,0 +1,93 @@ +# 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.dataprotection import DataProtectionMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python put_backup_instance_kubernetes_cluster_backup_datasource_parameters.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 = DataProtectionMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="62b829ee-7936-40c9-a1c9-47a93f9f3965", + ) + + response = client.backup_instances.begin_create_or_update( + resource_group_name="aksrg", + vault_name="aksvault", + backup_instance_name="aksbi", + parameters={ + "properties": { + "dataSourceInfo": { + "datasourceType": "Microsoft.ContainerService/managedclusters", + "objectType": "Datasource", + "resourceID": "/subscriptions/62b829ee-7936-40c9-a1c9-47a93f9f3965/resourceGroups/aksrg/providers/Microsoft.ContainerService/managedClusters/akscluster", + "resourceLocation": "eastus2euap", + "resourceName": "akscluster", + "resourceType": "Microsoft.ContainerService/managedclusters", + "resourceUri": "/subscriptions/62b829ee-7936-40c9-a1c9-47a93f9f3965/resourceGroups/aksrg/providers/Microsoft.ContainerService/managedClusters/akscluster", + }, + "dataSourceSetInfo": { + "datasourceType": "Microsoft.ContainerService/managedclusters", + "objectType": "DatasourceSet", + "resourceID": "/subscriptions/62b829ee-7936-40c9-a1c9-47a93f9f3965/resourceGroups/aksrg/providers/Microsoft.ContainerService/managedClusters/akscluster", + "resourceLocation": "eastus2euap", + "resourceName": "akscluster", + "resourceType": "Microsoft.ContainerService/managedclusters", + "resourceUri": "/subscriptions/62b829ee-7936-40c9-a1c9-47a93f9f3965/resourceGroups/aksrg/providers/Microsoft.ContainerService/managedClusters/akscluster", + }, + "friendlyName": "aksbi", + "objectType": "BackupInstance", + "policyInfo": { + "policyId": "/subscriptions/62b829ee-7936-40c9-a1c9-47a93f9f3965/resourcegroups/aksrg/providers/Microsoft.DataProtection/BackupVaults/aksvault/backupPolicies/akspolicy", + "policyParameters": { + "backupDatasourceParametersList": [ + { + "excludedNamespaces": ["kube-system"], + "excludedResourceTypes": ["v1/Secret"], + "includeClusterScopeResources": True, + "includedNamespaces": ["test"], + "includedResourceTypes": [], + "includedVolumeTypes": ["AzureDisk", "AzureFileShareSMB"], + "labelSelectors": [], + "objectType": "KubernetesClusterBackupDatasourceParameters", + "snapshotVolumes": True, + } + ], + "dataStoreParametersList": [ + { + "dataStoreType": "OperationalStore", + "objectType": "AzureOperationalStoreParameters", + "resourceGroupId": "/subscriptions/62b829ee-7936-40c9-a1c9-47a93f9f3965/resourceGroups/aksrg", + } + ], + }, + }, + }, + "tags": {"key1": "val1"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/BackupInstanceOperations/PutBackupInstance_KubernetesClusterBackupDatasourceParameters.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/put_backup_instance_resource_guard_enabled.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/put_backup_instance_resource_guard_enabled.py index bc9c7cdc6d90..309a6b949c7f 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/put_backup_instance_resource_guard_enabled.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/put_backup_instance_resource_guard_enabled.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.dataprotection import DataProtectionMgmtClient @@ -88,6 +86,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/BackupInstanceOperations/PutBackupInstance_ResourceGuardEnabled.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/BackupInstanceOperations/PutBackupInstance_ResourceGuardEnabled.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/resume_backups.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/resume_backups.py index 3a9cace6e7ab..3c52c72de766 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/resume_backups.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/resume_backups.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/BackupInstanceOperations/ResumeBackups.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/BackupInstanceOperations/ResumeBackups.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/resume_protection.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/resume_protection.py index 28ade62fc02a..d6527e57e2b1 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/resume_protection.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/resume_protection.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/BackupInstanceOperations/ResumeProtection.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/BackupInstanceOperations/ResumeProtection.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/stop_protection.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/stop_protection.py index 34f8b05c9acb..fbc98014c8e0 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/stop_protection.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/stop_protection.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/BackupInstanceOperations/StopProtection.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/BackupInstanceOperations/StopProtection.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/stop_protection_resource_guard_enabled.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/stop_protection_resource_guard_enabled.py index 4879ca5ec5c2..2ff9422c6b0a 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/stop_protection_resource_guard_enabled.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/stop_protection_resource_guard_enabled.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/BackupInstanceOperations/StopProtection_ResourceGuardEnabled.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/BackupInstanceOperations/StopProtection_ResourceGuardEnabled.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/suspend_backup_resource_guard_enabled.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/suspend_backup_resource_guard_enabled.py index deb8fdb3c4c0..58360238787d 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/suspend_backup_resource_guard_enabled.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/suspend_backup_resource_guard_enabled.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/BackupInstanceOperations/SuspendBackup_ResourceGuardEnabled.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/BackupInstanceOperations/SuspendBackup_ResourceGuardEnabled.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/suspend_backups.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/suspend_backups.py index 278000fba52c..43651e518c7b 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/suspend_backups.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/suspend_backups.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/BackupInstanceOperations/SuspendBackups.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/BackupInstanceOperations/SuspendBackups.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/sync_backup_instance.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/sync_backup_instance.py index ab15f550a395..9ed1e24e74fe 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/sync_backup_instance.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/sync_backup_instance.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.dataprotection import DataProtectionMgmtClient @@ -40,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/BackupInstanceOperations/SyncBackupInstance.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/BackupInstanceOperations/SyncBackupInstance.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/trigger_backup.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/trigger_backup.py index 309ab24a0fcd..089c70434829 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/trigger_backup.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/trigger_backup.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.dataprotection import DataProtectionMgmtClient @@ -43,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/BackupInstanceOperations/TriggerBackup.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/BackupInstanceOperations/TriggerBackup.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/trigger_rehydrate.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/trigger_rehydrate.py index 990052a83f2c..4af17a3841fd 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/trigger_rehydrate.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/trigger_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.dataprotection import DataProtectionMgmtClient @@ -44,6 +42,6 @@ def main(): ).result() -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/BackupInstanceOperations/TriggerRehydrate.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/BackupInstanceOperations/TriggerRehydrate.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/trigger_restore.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/trigger_restore.py index df77ad132850..00985e0a9f67 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/trigger_restore.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/trigger_restore.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.dataprotection import DataProtectionMgmtClient @@ -76,6 +74,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/BackupInstanceOperations/TriggerRestore.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/BackupInstanceOperations/TriggerRestore.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/trigger_restore_as_files.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/trigger_restore_as_files.py index 25c3767eaba8..c844d1d04ba5 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/trigger_restore_as_files.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/trigger_restore_as_files.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.dataprotection import DataProtectionMgmtClient @@ -56,6 +54,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/BackupInstanceOperations/TriggerRestoreAsFiles.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/BackupInstanceOperations/TriggerRestoreAsFiles.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/trigger_restore_with_rehydration.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/trigger_restore_with_rehydration.py index 55af77488e62..fb78c7ed9f06 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/trigger_restore_with_rehydration.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/trigger_restore_with_rehydration.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.dataprotection import DataProtectionMgmtClient @@ -71,6 +69,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/BackupInstanceOperations/TriggerRestoreWithRehydration.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/BackupInstanceOperations/TriggerRestoreWithRehydration.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/validate_for_backup.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/validate_for_backup.py index 2affb2d94c69..685a011865b5 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/validate_for_backup.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/validate_for_backup.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.dataprotection import DataProtectionMgmtClient @@ -73,6 +71,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/BackupInstanceOperations/ValidateForBackup.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/BackupInstanceOperations/ValidateForBackup.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/validate_for_modify_backup.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/validate_for_modify_backup.py new file mode 100644 index 000000000000..8d82ed15988b --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/validate_for_modify_backup.py @@ -0,0 +1,76 @@ +# 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.dataprotection import DataProtectionMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python validate_for_modify_backup.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 = DataProtectionMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + ) + + client.backup_instances.begin_validate_for_modify_backup( + resource_group_name="000pikumar", + vault_name="PratikPrivatePreviewVault1", + backup_instance_name="testInstance1", + parameters={ + "backupInstance": { + "dataSourceInfo": { + "datasourceType": "OssDB", + "objectType": "Datasource", + "resourceID": "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest/databases/testdb", + "resourceLocation": "", + "resourceName": "testdb", + "resourceType": "Microsoft.DBforPostgreSQL/servers/databases", + "resourceUri": "", + }, + "dataSourceSetInfo": { + "datasourceType": "OssDB", + "objectType": "DatasourceSet", + "resourceID": "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest", + "resourceLocation": "", + "resourceName": "viveksipgtest", + "resourceType": "Microsoft.DBforPostgreSQL/servers", + "resourceUri": "", + }, + "datasourceAuthCredentials": { + "objectType": "SecretStoreBasedAuthCredentials", + "secretStoreResource": { + "secretStoreType": "AzureKeyVault", + "uri": "https://samplevault.vault.azure.net/secrets/credentials", + }, + }, + "friendlyName": "harshitbi2", + "objectType": "BackupInstance", + "policyInfo": { + "policyId": "/subscriptions/04cf684a-d41f-4550-9f70-7708a3a2283b/resourceGroups/000pikumar/providers/Microsoft.DataProtection/Backupvaults/PratikPrivatePreviewVault1/backupPolicies/PratikPolicy1" + }, + } + }, + ).result() + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/BackupInstanceOperations/ValidateForModifyBackup.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/validate_restore.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/validate_restore.py index 593b9961325f..0e3f394d99e1 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/validate_restore.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/validate_restore.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.dataprotection import DataProtectionMgmtClient @@ -78,6 +76,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/BackupInstanceOperations/ValidateRestore.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/BackupInstanceOperations/ValidateRestore.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/checkfeature_support.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/checkfeature_support.py index 2a15d8bff824..30d722825c84 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/checkfeature_support.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/checkfeature_support.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.dataprotection import DataProtectionMgmtClient @@ -39,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/CheckfeatureSupport.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/CheckfeatureSupport.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/cross_region_restore/fetch_cross_region_restore_job.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/cross_region_restore/fetch_cross_region_restore_job.py index 9bc5bc4aef40..ebc1c0d0465e 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/cross_region_restore/fetch_cross_region_restore_job.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/cross_region_restore/fetch_cross_region_restore_job.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.dataprotection import DataProtectionMgmtClient @@ -44,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/CrossRegionRestore/FetchCrossRegionRestoreJob.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/CrossRegionRestore/FetchCrossRegionRestoreJob.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/cross_region_restore/fetch_cross_region_restore_jobs.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/cross_region_restore/fetch_cross_region_restore_jobs.py index 562ff663bb97..5c65a499eff6 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/cross_region_restore/fetch_cross_region_restore_jobs.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/cross_region_restore/fetch_cross_region_restore_jobs.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.dataprotection import DataProtectionMgmtClient @@ -44,6 +42,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/CrossRegionRestore/FetchCrossRegionRestoreJobs.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/CrossRegionRestore/FetchCrossRegionRestoreJobs.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/cross_region_restore/fetch_secondary_rps.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/cross_region_restore/fetch_secondary_rps.py index 3d83cafb2842..05a68e2b2564 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/cross_region_restore/fetch_secondary_rps.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/cross_region_restore/fetch_secondary_rps.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.dataprotection import DataProtectionMgmtClient @@ -44,6 +42,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/CrossRegionRestore/FetchSecondaryRPs.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/CrossRegionRestore/FetchSecondaryRPs.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/cross_region_restore/trigger_cross_region_restore.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/cross_region_restore/trigger_cross_region_restore.py index 0a3a4e27eced..9f6833a55cae 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/cross_region_restore/trigger_cross_region_restore.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/cross_region_restore/trigger_cross_region_restore.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.dataprotection import DataProtectionMgmtClient @@ -81,6 +79,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/CrossRegionRestore/TriggerCrossRegionRestore.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/CrossRegionRestore/TriggerCrossRegionRestore.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/cross_region_restore/validate_cross_region_restore.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/cross_region_restore/validate_cross_region_restore.py index bbe19e16c014..7aeae8d0ba09 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/cross_region_restore/validate_cross_region_restore.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/cross_region_restore/validate_cross_region_restore.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.dataprotection import DataProtectionMgmtClient @@ -81,6 +79,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/CrossRegionRestore/ValidateCrossRegionRestore.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/CrossRegionRestore/ValidateCrossRegionRestore.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/deleted_backup_instance_operations/get_deleted_backup_instance.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/deleted_backup_instance_operations/get_deleted_backup_instance.py index 7be303f55289..46fecafa09e7 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/deleted_backup_instance_operations/get_deleted_backup_instance.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/deleted_backup_instance_operations/get_deleted_backup_instance.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/DeletedBackupInstanceOperations/GetDeletedBackupInstance.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/DeletedBackupInstanceOperations/GetDeletedBackupInstance.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/deleted_backup_instance_operations/list_deleted_backup_instances.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/deleted_backup_instance_operations/list_deleted_backup_instances.py index 32710025c57a..0a33fc152534 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/deleted_backup_instance_operations/list_deleted_backup_instances.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/deleted_backup_instance_operations/list_deleted_backup_instances.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/DeletedBackupInstanceOperations/ListDeletedBackupInstances.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/DeletedBackupInstanceOperations/ListDeletedBackupInstances.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/deleted_backup_instance_operations/undelete_deleted_backup_instance.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/deleted_backup_instance_operations/undelete_deleted_backup_instance.py index 9fdc8c8785ed..6ebbdfb44262 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/deleted_backup_instance_operations/undelete_deleted_backup_instance.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/deleted_backup_instance_operations/undelete_deleted_backup_instance.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/DeletedBackupInstanceOperations/UndeleteDeletedBackupInstance.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/DeletedBackupInstanceOperations/UndeleteDeletedBackupInstance.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_result.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_result.py index 84c238dbc9c8..505cc32cd854 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_result.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_result.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/GetOperationResult.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/GetOperationResult.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_status.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_status.py index 16dcda099e7f..65e6bb655858 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_status.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_status.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/GetOperationStatus.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/GetOperationStatus.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_status_rg_context.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_status_rg_context.py index 446cfdfec1a8..12c9daac1304 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_status_rg_context.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_status_rg_context.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/GetOperationStatusRGContext.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/GetOperationStatusRGContext.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_status_vault_context.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_status_vault_context.py index 788c063ede45..41f62a428eb0 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_status_vault_context.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_status_vault_context.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/GetOperationStatusVaultContext.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/GetOperationStatusVaultContext.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/job_crud/get_export_jobs_operation_result.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/job_crud/get_export_jobs_operation_result.py index 2ced5becbee8..bd7b013a4c8a 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/job_crud/get_export_jobs_operation_result.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/job_crud/get_export_jobs_operation_result.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/JobCRUD/GetExportJobsOperationResult.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/JobCRUD/GetExportJobsOperationResult.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/job_crud/get_job.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/job_crud/get_job.py index cb84bfe490e4..f62f4c81628c 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/job_crud/get_job.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/job_crud/get_job.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/JobCRUD/GetJob.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/JobCRUD/GetJob.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/job_crud/list_jobs.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/job_crud/list_jobs.py index 4500a3bc66d4..c03173d6eedf 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/job_crud/list_jobs.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/job_crud/list_jobs.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/JobCRUD/ListJobs.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/JobCRUD/ListJobs.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/job_crud/trigger_export_jobs.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/job_crud/trigger_export_jobs.py index f5bcc623859f..e4414eaae593 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/job_crud/trigger_export_jobs.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/job_crud/trigger_export_jobs.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/JobCRUD/TriggerExportJobs.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/JobCRUD/TriggerExportJobs.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/operations/list.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/operations/list.py index 7a88a8308805..a7abef0f9e7b 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/operations/list.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/operations/list.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/Operations/List.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/Operations/List.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/policy_crud/create_or_update_backup_policy.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/policy_crud/create_or_update_backup_policy.py index e2273ebe4cdc..0f79480896c3 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/policy_crud/create_or_update_backup_policy.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/policy_crud/create_or_update_backup_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.dataprotection import DataProtectionMgmtClient @@ -95,6 +93,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/PolicyCRUD/CreateOrUpdateBackupPolicy.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/PolicyCRUD/CreateOrUpdateBackupPolicy.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/policy_crud/delete_backup_policy.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/policy_crud/delete_backup_policy.py index 6e7fee02b392..a2fe0c2f7525 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/policy_crud/delete_backup_policy.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/policy_crud/delete_backup_policy.py @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/PolicyCRUD/DeleteBackupPolicy.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/PolicyCRUD/DeleteBackupPolicy.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/policy_crud/get_backup_policy.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/policy_crud/get_backup_policy.py index e881df3cda4d..8da4ea2767f2 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/policy_crud/get_backup_policy.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/policy_crud/get_backup_policy.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/PolicyCRUD/GetBackupPolicy.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/PolicyCRUD/GetBackupPolicy.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/policy_crud/list_backup_policy.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/policy_crud/list_backup_policy.py index 64c15ce0e631..038066286731 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/policy_crud/list_backup_policy.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/policy_crud/list_backup_policy.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/PolicyCRUD/ListBackupPolicy.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/PolicyCRUD/ListBackupPolicy.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/delete_resource_guard.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/delete_resource_guard.py index a81ad9812740..41a03abbd153 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/delete_resource_guard.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/delete_resource_guard.py @@ -36,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/ResourceGuardCRUD/DeleteResourceGuard.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/ResourceGuardCRUD/DeleteResourceGuard.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_backup_security_pin_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_backup_security_pin_requests.py index 3603dd8d05c6..1c627f81cbe9 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_backup_security_pin_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_backup_security_pin_requests.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/ResourceGuardCRUD/GetDefaultBackupSecurityPINRequests.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/ResourceGuardCRUD/GetDefaultBackupSecurityPINRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_delete_protected_item_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_delete_protected_item_requests.py index 31ed30f8bdae..8d89b06aca54 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_delete_protected_item_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_delete_protected_item_requests.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/ResourceGuardCRUD/GetDefaultDeleteProtectedItemRequests.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/ResourceGuardCRUD/GetDefaultDeleteProtectedItemRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_delete_resource_guard_proxy_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_delete_resource_guard_proxy_requests.py index 10b88c7a46f7..985b94f8c637 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_delete_resource_guard_proxy_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_delete_resource_guard_proxy_requests.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/ResourceGuardCRUD/GetDefaultDeleteResourceGuardProxyRequests.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/ResourceGuardCRUD/GetDefaultDeleteResourceGuardProxyRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_disable_soft_delete_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_disable_soft_delete_requests.py index d3f1f336538a..d21ed9ee257d 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_disable_soft_delete_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_disable_soft_delete_requests.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/ResourceGuardCRUD/GetDefaultDisableSoftDeleteRequests.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/ResourceGuardCRUD/GetDefaultDisableSoftDeleteRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_update_protected_item_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_update_protected_item_requests.py index a0050f3a114f..9322c261446d 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_update_protected_item_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_update_protected_item_requests.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/ResourceGuardCRUD/GetDefaultUpdateProtectedItemRequests.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/ResourceGuardCRUD/GetDefaultUpdateProtectedItemRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_update_protection_policy_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_update_protection_policy_requests.py index bca4f4bf8f59..fbd77d6fea4e 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_update_protection_policy_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_update_protection_policy_requests.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/ResourceGuardCRUD/GetDefaultUpdateProtectionPolicyRequests.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/ResourceGuardCRUD/GetDefaultUpdateProtectionPolicyRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_resource_guard.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_resource_guard.py index c3666b6407fb..ea3400be41f2 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_resource_guard.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_resource_guard.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/ResourceGuardCRUD/GetResourceGuard.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/ResourceGuardCRUD/GetResourceGuard.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_resource_guards_in_resource_group.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_resource_guards_in_resource_group.py index f26da44fe848..34ee828b9e7d 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_resource_guards_in_resource_group.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_resource_guards_in_resource_group.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/ResourceGuardCRUD/GetResourceGuardsInResourceGroup.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/ResourceGuardCRUD/GetResourceGuardsInResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_resource_guards_in_subscription.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_resource_guards_in_subscription.py index 85df4b590d21..a1d724684196 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_resource_guards_in_subscription.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_resource_guards_in_subscription.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/ResourceGuardCRUD/GetResourceGuardsInSubscription.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/ResourceGuardCRUD/GetResourceGuardsInSubscription.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_backup_security_pin_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_backup_security_pin_requests.py index 430645782f4c..1b9ae4d475b9 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_backup_security_pin_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_backup_security_pin_requests.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/ResourceGuardCRUD/ListBackupSecurityPINRequests.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/ResourceGuardCRUD/ListBackupSecurityPINRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_delete_protected_item_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_delete_protected_item_requests.py index 51275bcf898a..72b9a2ac1014 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_delete_protected_item_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_delete_protected_item_requests.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/ResourceGuardCRUD/ListDeleteProtectedItemRequests.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/ResourceGuardCRUD/ListDeleteProtectedItemRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_delete_resource_guard_proxy_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_delete_resource_guard_proxy_requests.py index f108c0045db5..5dac18dd7d51 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_delete_resource_guard_proxy_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_delete_resource_guard_proxy_requests.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/ResourceGuardCRUD/ListDeleteResourceGuardProxyRequests.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/ResourceGuardCRUD/ListDeleteResourceGuardProxyRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_disable_soft_delete_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_disable_soft_delete_requests.py index f5e5512e41b3..5a720f34391c 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_disable_soft_delete_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_disable_soft_delete_requests.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/ResourceGuardCRUD/ListDisableSoftDeleteRequests.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/ResourceGuardCRUD/ListDisableSoftDeleteRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_update_protected_item_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_update_protected_item_requests.py index b54da0480395..5399881aa470 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_update_protected_item_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_update_protected_item_requests.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/ResourceGuardCRUD/ListUpdateProtectedItemRequests.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/ResourceGuardCRUD/ListUpdateProtectedItemRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_update_protection_policy_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_update_protection_policy_requests.py index c7b0faf2878d..334ab27ee34d 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_update_protection_policy_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_update_protection_policy_requests.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/ResourceGuardCRUD/ListUpdateProtectionPolicyRequests.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/ResourceGuardCRUD/ListUpdateProtectionPolicyRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/patch_resource_guard.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/patch_resource_guard.py index b40c5096e602..e34ebc996aa1 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/patch_resource_guard.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/patch_resource_guard.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.dataprotection import DataProtectionMgmtClient @@ -40,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/ResourceGuardCRUD/PatchResourceGuard.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/ResourceGuardCRUD/PatchResourceGuard.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/put_resource_guard.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/put_resource_guard.py index a1cc47107e27..91e0c1b7d6d6 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/put_resource_guard.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/put_resource_guard.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.dataprotection import DataProtectionMgmtClient @@ -40,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/ResourceGuardCRUD/PutResourceGuard.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/ResourceGuardCRUD/PutResourceGuard.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_proxy_crud/delete_resource_guard_proxy.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_proxy_crud/delete_resource_guard_proxy.py index e950921b3b50..f3d8c2b8d355 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_proxy_crud/delete_resource_guard_proxy.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_proxy_crud/delete_resource_guard_proxy.py @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/ResourceGuardProxyCRUD/DeleteResourceGuardProxy.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/ResourceGuardProxyCRUD/DeleteResourceGuardProxy.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_proxy_crud/get_resource_guard_proxy.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_proxy_crud/get_resource_guard_proxy.py index 7b3a32e7dacd..b7bc7c49edf7 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_proxy_crud/get_resource_guard_proxy.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_proxy_crud/get_resource_guard_proxy.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/ResourceGuardProxyCRUD/GetResourceGuardProxy.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/ResourceGuardProxyCRUD/GetResourceGuardProxy.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_proxy_crud/list_resource_guard_proxy.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_proxy_crud/list_resource_guard_proxy.py index ad626b87240a..46923b8d7338 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_proxy_crud/list_resource_guard_proxy.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_proxy_crud/list_resource_guard_proxy.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/ResourceGuardProxyCRUD/ListResourceGuardProxy.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/ResourceGuardProxyCRUD/ListResourceGuardProxy.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_proxy_crud/put_resource_guard_proxy.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_proxy_crud/put_resource_guard_proxy.py index b1ea1686991b..4a383596498c 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_proxy_crud/put_resource_guard_proxy.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/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.dataprotection import DataProtectionMgmtClient @@ -45,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/ResourceGuardProxyCRUD/PutResourceGuardProxy.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/ResourceGuardProxyCRUD/PutResourceGuardProxy.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_proxy_crud/unlock_delete_resource_guard_proxy.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_proxy_crud/unlock_delete_resource_guard_proxy.py index 219a7e5983e2..360d9066e174 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_proxy_crud/unlock_delete_resource_guard_proxy.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/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.dataprotection import DataProtectionMgmtClient @@ -46,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/ResourceGuardProxyCRUD/UnlockDeleteResourceGuardProxy.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/ResourceGuardProxyCRUD/UnlockDeleteResourceGuardProxy.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/check_backup_vaults_name_availability.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/check_backup_vaults_name_availability.py index 9c2526c117e5..00c5c5a3c592 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/check_backup_vaults_name_availability.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/check_backup_vaults_name_availability.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.dataprotection import DataProtectionMgmtClient @@ -40,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/VaultCRUD/CheckBackupVaultsNameAvailability.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/VaultCRUD/CheckBackupVaultsNameAvailability.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/delete_backup_vault.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/delete_backup_vault.py index d5fdd0ac38bc..d7c96ba0593b 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/delete_backup_vault.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/delete_backup_vault.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/VaultCRUD/DeleteBackupVault.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/VaultCRUD/DeleteBackupVault.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_backup_vault.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_backup_vault.py index 527cdbb9d2c4..9c762f180cc6 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_backup_vault.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_backup_vault.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/VaultCRUD/GetBackupVault.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/VaultCRUD/GetBackupVault.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_backup_vault_with_cmk.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_backup_vault_with_cmk.py index 4507887c3fec..6f7cc4807ec8 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_backup_vault_with_cmk.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_backup_vault_with_cmk.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/VaultCRUD/GetBackupVaultWithCMK.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/VaultCRUD/GetBackupVaultWithCMK.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_backup_vault_with_msi.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_backup_vault_with_msi.py index d42aff54d2d2..9cecb0ef8959 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_backup_vault_with_msi.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_backup_vault_with_msi.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/VaultCRUD/GetBackupVaultWithMSI.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/VaultCRUD/GetBackupVaultWithMSI.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_backup_vaults_in_resource_group.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_backup_vaults_in_resource_group.py index 2ff6a8ebad33..03b31940bdc0 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_backup_vaults_in_resource_group.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_backup_vaults_in_resource_group.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/VaultCRUD/GetBackupVaultsInResourceGroup.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/VaultCRUD/GetBackupVaultsInResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_backup_vaults_in_subscription.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_backup_vaults_in_subscription.py index 3cf0732e5e7f..25348be747c3 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_backup_vaults_in_subscription.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_backup_vaults_in_subscription.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/VaultCRUD/GetBackupVaultsInSubscription.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/VaultCRUD/GetBackupVaultsInSubscription.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_operation_result_patch.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_operation_result_patch.py index f0d326d644ec..806b8cb3a4b6 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_operation_result_patch.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_operation_result_patch.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/VaultCRUD/GetOperationResultPatch.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/VaultCRUD/GetOperationResultPatch.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/patch_backup_vault.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/patch_backup_vault.py index 7dac9a7be9d0..d4ccb89623f7 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/patch_backup_vault.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/patch_backup_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.dataprotection import DataProtectionMgmtClient @@ -43,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/VaultCRUD/PatchBackupVault.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/VaultCRUD/PatchBackupVault.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/patch_backup_vault_with_cmk.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/patch_backup_vault_with_cmk.py index e303ee0c0805..0f475e42aef3 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/patch_backup_vault_with_cmk.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/patch_backup_vault_with_cmk.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.dataprotection import DataProtectionMgmtClient @@ -57,6 +55,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/VaultCRUD/PatchBackupVaultWithCMK.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/VaultCRUD/PatchBackupVaultWithCMK.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/put_backup_vault.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/put_backup_vault.py index 3211aaf4e361..ac1c6629d74f 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/put_backup_vault.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/put_backup_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.dataprotection import DataProtectionMgmtClient @@ -50,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/VaultCRUD/PutBackupVault.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/VaultCRUD/PutBackupVault.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/put_backup_vault_with_cmk.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/put_backup_vault_with_cmk.py index 78e9a47082a7..826a16225804 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/put_backup_vault_with_cmk.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/put_backup_vault_with_cmk.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.dataprotection import DataProtectionMgmtClient @@ -63,6 +61,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/VaultCRUD/PutBackupVaultWithCMK.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/VaultCRUD/PutBackupVaultWithCMK.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/put_backup_vault_with_msi.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/put_backup_vault_with_msi.py index 64e832da3a2a..b2ad7d280b32 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/put_backup_vault_with_msi.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/put_backup_vault_with_msi.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.dataprotection import DataProtectionMgmtClient @@ -50,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/VaultCRUD/PutBackupVaultWithMSI.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2025-02-01/examples/VaultCRUD/PutBackupVaultWithMSI.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/conftest.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/conftest.py new file mode 100644 index 000000000000..a030462cf66b --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/conftest.py @@ -0,0 +1,35 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import os +import pytest +from dotenv import load_dotenv +from devtools_testutils import ( + test_proxy, + add_general_regex_sanitizer, + add_body_key_sanitizer, + add_header_regex_sanitizer, +) + +load_dotenv() + + +# For security, please avoid record sensitive identity information in recordings +@pytest.fixture(scope="session", autouse=True) +def add_sanitizers(test_proxy): + dataprotectionmgmt_subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") + dataprotectionmgmt_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") + dataprotectionmgmt_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") + dataprotectionmgmt_client_secret = os.environ.get("AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=dataprotectionmgmt_subscription_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=dataprotectionmgmt_tenant_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=dataprotectionmgmt_client_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=dataprotectionmgmt_client_secret, value="00000000-0000-0000-0000-000000000000") + + add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") + add_header_regex_sanitizer(key="Cookie", value="cookie;") + add_body_key_sanitizer(json_path="$..access_token", value="access_token") diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_backup_instances_extension_routing_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_backup_instances_extension_routing_operations.py new file mode 100644 index 000000000000..b126f8f470e8 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_backup_instances_extension_routing_operations.py @@ -0,0 +1,30 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection import DataProtectionMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionMgmtBackupInstancesExtensionRoutingOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_instances_extension_routing_list(self, resource_group): + response = self.client.backup_instances_extension_routing.list( + resource_id="str", + api_version="2025-02-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_backup_instances_extension_routing_operations_async.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_backup_instances_extension_routing_operations_async.py new file mode 100644 index 000000000000..c9a57dd8f399 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_backup_instances_extension_routing_operations_async.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection.aio import DataProtectionMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionMgmtBackupInstancesExtensionRoutingOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_instances_extension_routing_list(self, resource_group): + response = self.client.backup_instances_extension_routing.list( + resource_id="str", + api_version="2025-02-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_backup_instances_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_backup_instances_operations.py new file mode 100644 index 000000000000..1d22f40d7ce9 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_backup_instances_operations.py @@ -0,0 +1,480 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection import DataProtectionMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionMgmtBackupInstancesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_instances_list(self, resource_group): + response = self.client.backup_instances.list( + resource_group_name=resource_group.name, + vault_name="str", + api_version="2025-02-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_instances_get(self, resource_group): + response = self.client.backup_instances.get( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_instances_begin_create_or_update(self, resource_group): + response = self.client.backup_instances.begin_create_or_update( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + parameters={ + "id": "str", + "name": "str", + "properties": { + "dataSourceInfo": { + "resourceID": "str", + "datasourceType": "str", + "objectType": "str", + "resourceLocation": "str", + "resourceName": "str", + "resourceProperties": "base_resource_properties", + "resourceType": "str", + "resourceUri": "str", + }, + "objectType": "str", + "policyInfo": { + "policyId": "str", + "policyParameters": { + "backupDatasourceParametersList": ["backup_datasource_parameters"], + "dataStoreParametersList": ["data_store_parameters"], + }, + "policyVersion": "str", + }, + "currentProtectionState": "str", + "dataSourceSetInfo": { + "resourceID": "str", + "datasourceType": "str", + "objectType": "str", + "resourceLocation": "str", + "resourceName": "str", + "resourceProperties": "base_resource_properties", + "resourceType": "str", + "resourceUri": "str", + }, + "datasourceAuthCredentials": "auth_credentials", + "friendlyName": "str", + "identityDetails": {"useSystemAssignedIdentity": bool, "userAssignedIdentityArmUrl": "str"}, + "protectionErrorDetails": { + "code": "str", + "details": [...], + "innerError": {"additionalInfo": {"str": "str"}, "code": "str", "embeddedInnerError": ...}, + "isRetryable": bool, + "isUserError": bool, + "message": "str", + "properties": {"str": "str"}, + "recommendedAction": ["str"], + "target": "str", + }, + "protectionStatus": { + "errorDetails": { + "code": "str", + "details": [...], + "innerError": {"additionalInfo": {"str": "str"}, "code": "str", "embeddedInnerError": ...}, + "isRetryable": bool, + "isUserError": bool, + "message": "str", + "properties": {"str": "str"}, + "recommendedAction": ["str"], + "target": "str", + }, + "status": "str", + }, + "provisioningState": "str", + "resourceGuardOperationRequests": ["str"], + "validationType": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2025-02-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_instances_begin_delete(self, resource_group): + response = self.client.backup_instances.begin_delete( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + api_version="2025-02-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_instances_begin_adhoc_backup(self, resource_group): + response = self.client.backup_instances.begin_adhoc_backup( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + parameters={"backupRuleOptions": {"ruleName": "str", "triggerOption": {"retentionTagOverride": "str"}}}, + api_version="2025-02-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_instances_begin_validate_for_backup(self, resource_group): + response = self.client.backup_instances.begin_validate_for_backup( + resource_group_name=resource_group.name, + vault_name="str", + parameters={ + "backupInstance": { + "dataSourceInfo": { + "resourceID": "str", + "datasourceType": "str", + "objectType": "str", + "resourceLocation": "str", + "resourceName": "str", + "resourceProperties": "base_resource_properties", + "resourceType": "str", + "resourceUri": "str", + }, + "objectType": "str", + "policyInfo": { + "policyId": "str", + "policyParameters": { + "backupDatasourceParametersList": ["backup_datasource_parameters"], + "dataStoreParametersList": ["data_store_parameters"], + }, + "policyVersion": "str", + }, + "currentProtectionState": "str", + "dataSourceSetInfo": { + "resourceID": "str", + "datasourceType": "str", + "objectType": "str", + "resourceLocation": "str", + "resourceName": "str", + "resourceProperties": "base_resource_properties", + "resourceType": "str", + "resourceUri": "str", + }, + "datasourceAuthCredentials": "auth_credentials", + "friendlyName": "str", + "identityDetails": {"useSystemAssignedIdentity": bool, "userAssignedIdentityArmUrl": "str"}, + "protectionErrorDetails": { + "code": "str", + "details": [...], + "innerError": {"additionalInfo": {"str": "str"}, "code": "str", "embeddedInnerError": ...}, + "isRetryable": bool, + "isUserError": bool, + "message": "str", + "properties": {"str": "str"}, + "recommendedAction": ["str"], + "target": "str", + }, + "protectionStatus": { + "errorDetails": { + "code": "str", + "details": [...], + "innerError": {"additionalInfo": {"str": "str"}, "code": "str", "embeddedInnerError": ...}, + "isRetryable": bool, + "isUserError": bool, + "message": "str", + "properties": {"str": "str"}, + "recommendedAction": ["str"], + "target": "str", + }, + "status": "str", + }, + "provisioningState": "str", + "resourceGuardOperationRequests": ["str"], + "validationType": "str", + } + }, + api_version="2025-02-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_instances_begin_validate_for_modify_backup(self, resource_group): + response = self.client.backup_instances.begin_validate_for_modify_backup( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + parameters={ + "backupInstance": { + "dataSourceInfo": { + "resourceID": "str", + "datasourceType": "str", + "objectType": "str", + "resourceLocation": "str", + "resourceName": "str", + "resourceProperties": "base_resource_properties", + "resourceType": "str", + "resourceUri": "str", + }, + "objectType": "str", + "policyInfo": { + "policyId": "str", + "policyParameters": { + "backupDatasourceParametersList": ["backup_datasource_parameters"], + "dataStoreParametersList": ["data_store_parameters"], + }, + "policyVersion": "str", + }, + "currentProtectionState": "str", + "dataSourceSetInfo": { + "resourceID": "str", + "datasourceType": "str", + "objectType": "str", + "resourceLocation": "str", + "resourceName": "str", + "resourceProperties": "base_resource_properties", + "resourceType": "str", + "resourceUri": "str", + }, + "datasourceAuthCredentials": "auth_credentials", + "friendlyName": "str", + "identityDetails": {"useSystemAssignedIdentity": bool, "userAssignedIdentityArmUrl": "str"}, + "protectionErrorDetails": { + "code": "str", + "details": [...], + "innerError": {"additionalInfo": {"str": "str"}, "code": "str", "embeddedInnerError": ...}, + "isRetryable": bool, + "isUserError": bool, + "message": "str", + "properties": {"str": "str"}, + "recommendedAction": ["str"], + "target": "str", + }, + "protectionStatus": { + "errorDetails": { + "code": "str", + "details": [...], + "innerError": {"additionalInfo": {"str": "str"}, "code": "str", "embeddedInnerError": ...}, + "isRetryable": bool, + "isUserError": bool, + "message": "str", + "properties": {"str": "str"}, + "recommendedAction": ["str"], + "target": "str", + }, + "status": "str", + }, + "provisioningState": "str", + "resourceGuardOperationRequests": ["str"], + "validationType": "str", + } + }, + api_version="2025-02-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_instances_get_backup_instance_operation_result(self, resource_group): + response = self.client.backup_instances.get_backup_instance_operation_result( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + operation_id="str", + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_instances_begin_trigger_cross_region_restore(self, resource_group): + response = self.client.backup_instances.begin_trigger_cross_region_restore( + resource_group_name=resource_group.name, + location="str", + parameters={ + "crossRegionRestoreDetails": {"sourceBackupInstanceId": "str", "sourceRegion": "str"}, + "restoreRequestObject": "azure_backup_restore_request", + }, + api_version="2025-02-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_instances_begin_validate_cross_region_restore(self, resource_group): + response = self.client.backup_instances.begin_validate_cross_region_restore( + resource_group_name=resource_group.name, + location="str", + parameters={ + "crossRegionRestoreDetails": {"sourceBackupInstanceId": "str", "sourceRegion": "str"}, + "restoreRequestObject": "azure_backup_restore_request", + }, + api_version="2025-02-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_instances_begin_trigger_rehydrate(self, resource_group): + response = self.client.backup_instances.begin_trigger_rehydrate( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + parameters={"recoveryPointId": "str", "rehydrationRetentionDuration": "str", "rehydrationPriority": "str"}, + api_version="2025-02-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_instances_begin_trigger_restore(self, resource_group): + response = self.client.backup_instances.begin_trigger_restore( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + parameters={ + "objectType": "AzureBackupRestoreWithRehydrationRequest", + "recoveryPointId": "str", + "rehydrationPriority": "str", + "rehydrationRetentionDuration": "str", + "restoreTargetInfo": "restore_target_info_base", + "sourceDataStoreType": "str", + "identityDetails": {"useSystemAssignedIdentity": bool, "userAssignedIdentityArmUrl": "str"}, + "resourceGuardOperationRequests": ["str"], + "sourceResourceId": "str", + }, + api_version="2025-02-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_instances_begin_resume_backups(self, resource_group): + response = self.client.backup_instances.begin_resume_backups( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + api_version="2025-02-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_instances_begin_resume_protection(self, resource_group): + response = self.client.backup_instances.begin_resume_protection( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + api_version="2025-02-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_instances_begin_stop_protection(self, resource_group): + response = self.client.backup_instances.begin_stop_protection( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + api_version="2025-02-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_instances_begin_suspend_backups(self, resource_group): + response = self.client.backup_instances.begin_suspend_backups( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + api_version="2025-02-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_instances_begin_sync_backup_instance(self, resource_group): + response = self.client.backup_instances.begin_sync_backup_instance( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + parameters={"syncType": "str"}, + api_version="2025-02-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_instances_begin_validate_for_restore(self, resource_group): + response = self.client.backup_instances.begin_validate_for_restore( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + parameters={"restoreRequestObject": "azure_backup_restore_request"}, + api_version="2025-02-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_backup_instances_operations_async.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_backup_instances_operations_async.py new file mode 100644 index 000000000000..a08335b22d39 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_backup_instances_operations_async.py @@ -0,0 +1,527 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection.aio import DataProtectionMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionMgmtBackupInstancesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_instances_list(self, resource_group): + response = self.client.backup_instances.list( + resource_group_name=resource_group.name, + vault_name="str", + api_version="2025-02-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_instances_get(self, resource_group): + response = await self.client.backup_instances.get( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_instances_begin_create_or_update(self, resource_group): + response = await ( + await self.client.backup_instances.begin_create_or_update( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + parameters={ + "id": "str", + "name": "str", + "properties": { + "dataSourceInfo": { + "resourceID": "str", + "datasourceType": "str", + "objectType": "str", + "resourceLocation": "str", + "resourceName": "str", + "resourceProperties": "base_resource_properties", + "resourceType": "str", + "resourceUri": "str", + }, + "objectType": "str", + "policyInfo": { + "policyId": "str", + "policyParameters": { + "backupDatasourceParametersList": ["backup_datasource_parameters"], + "dataStoreParametersList": ["data_store_parameters"], + }, + "policyVersion": "str", + }, + "currentProtectionState": "str", + "dataSourceSetInfo": { + "resourceID": "str", + "datasourceType": "str", + "objectType": "str", + "resourceLocation": "str", + "resourceName": "str", + "resourceProperties": "base_resource_properties", + "resourceType": "str", + "resourceUri": "str", + }, + "datasourceAuthCredentials": "auth_credentials", + "friendlyName": "str", + "identityDetails": {"useSystemAssignedIdentity": bool, "userAssignedIdentityArmUrl": "str"}, + "protectionErrorDetails": { + "code": "str", + "details": [...], + "innerError": {"additionalInfo": {"str": "str"}, "code": "str", "embeddedInnerError": ...}, + "isRetryable": bool, + "isUserError": bool, + "message": "str", + "properties": {"str": "str"}, + "recommendedAction": ["str"], + "target": "str", + }, + "protectionStatus": { + "errorDetails": { + "code": "str", + "details": [...], + "innerError": { + "additionalInfo": {"str": "str"}, + "code": "str", + "embeddedInnerError": ..., + }, + "isRetryable": bool, + "isUserError": bool, + "message": "str", + "properties": {"str": "str"}, + "recommendedAction": ["str"], + "target": "str", + }, + "status": "str", + }, + "provisioningState": "str", + "resourceGuardOperationRequests": ["str"], + "validationType": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2025-02-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_instances_begin_delete(self, resource_group): + response = await ( + await self.client.backup_instances.begin_delete( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + api_version="2025-02-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_instances_begin_adhoc_backup(self, resource_group): + response = await ( + await self.client.backup_instances.begin_adhoc_backup( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + parameters={"backupRuleOptions": {"ruleName": "str", "triggerOption": {"retentionTagOverride": "str"}}}, + api_version="2025-02-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_instances_begin_validate_for_backup(self, resource_group): + response = await ( + await self.client.backup_instances.begin_validate_for_backup( + resource_group_name=resource_group.name, + vault_name="str", + parameters={ + "backupInstance": { + "dataSourceInfo": { + "resourceID": "str", + "datasourceType": "str", + "objectType": "str", + "resourceLocation": "str", + "resourceName": "str", + "resourceProperties": "base_resource_properties", + "resourceType": "str", + "resourceUri": "str", + }, + "objectType": "str", + "policyInfo": { + "policyId": "str", + "policyParameters": { + "backupDatasourceParametersList": ["backup_datasource_parameters"], + "dataStoreParametersList": ["data_store_parameters"], + }, + "policyVersion": "str", + }, + "currentProtectionState": "str", + "dataSourceSetInfo": { + "resourceID": "str", + "datasourceType": "str", + "objectType": "str", + "resourceLocation": "str", + "resourceName": "str", + "resourceProperties": "base_resource_properties", + "resourceType": "str", + "resourceUri": "str", + }, + "datasourceAuthCredentials": "auth_credentials", + "friendlyName": "str", + "identityDetails": {"useSystemAssignedIdentity": bool, "userAssignedIdentityArmUrl": "str"}, + "protectionErrorDetails": { + "code": "str", + "details": [...], + "innerError": {"additionalInfo": {"str": "str"}, "code": "str", "embeddedInnerError": ...}, + "isRetryable": bool, + "isUserError": bool, + "message": "str", + "properties": {"str": "str"}, + "recommendedAction": ["str"], + "target": "str", + }, + "protectionStatus": { + "errorDetails": { + "code": "str", + "details": [...], + "innerError": { + "additionalInfo": {"str": "str"}, + "code": "str", + "embeddedInnerError": ..., + }, + "isRetryable": bool, + "isUserError": bool, + "message": "str", + "properties": {"str": "str"}, + "recommendedAction": ["str"], + "target": "str", + }, + "status": "str", + }, + "provisioningState": "str", + "resourceGuardOperationRequests": ["str"], + "validationType": "str", + } + }, + api_version="2025-02-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_instances_begin_validate_for_modify_backup(self, resource_group): + response = await ( + await self.client.backup_instances.begin_validate_for_modify_backup( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + parameters={ + "backupInstance": { + "dataSourceInfo": { + "resourceID": "str", + "datasourceType": "str", + "objectType": "str", + "resourceLocation": "str", + "resourceName": "str", + "resourceProperties": "base_resource_properties", + "resourceType": "str", + "resourceUri": "str", + }, + "objectType": "str", + "policyInfo": { + "policyId": "str", + "policyParameters": { + "backupDatasourceParametersList": ["backup_datasource_parameters"], + "dataStoreParametersList": ["data_store_parameters"], + }, + "policyVersion": "str", + }, + "currentProtectionState": "str", + "dataSourceSetInfo": { + "resourceID": "str", + "datasourceType": "str", + "objectType": "str", + "resourceLocation": "str", + "resourceName": "str", + "resourceProperties": "base_resource_properties", + "resourceType": "str", + "resourceUri": "str", + }, + "datasourceAuthCredentials": "auth_credentials", + "friendlyName": "str", + "identityDetails": {"useSystemAssignedIdentity": bool, "userAssignedIdentityArmUrl": "str"}, + "protectionErrorDetails": { + "code": "str", + "details": [...], + "innerError": {"additionalInfo": {"str": "str"}, "code": "str", "embeddedInnerError": ...}, + "isRetryable": bool, + "isUserError": bool, + "message": "str", + "properties": {"str": "str"}, + "recommendedAction": ["str"], + "target": "str", + }, + "protectionStatus": { + "errorDetails": { + "code": "str", + "details": [...], + "innerError": { + "additionalInfo": {"str": "str"}, + "code": "str", + "embeddedInnerError": ..., + }, + "isRetryable": bool, + "isUserError": bool, + "message": "str", + "properties": {"str": "str"}, + "recommendedAction": ["str"], + "target": "str", + }, + "status": "str", + }, + "provisioningState": "str", + "resourceGuardOperationRequests": ["str"], + "validationType": "str", + } + }, + api_version="2025-02-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_instances_get_backup_instance_operation_result(self, resource_group): + response = await self.client.backup_instances.get_backup_instance_operation_result( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + operation_id="str", + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_instances_begin_trigger_cross_region_restore(self, resource_group): + response = await ( + await self.client.backup_instances.begin_trigger_cross_region_restore( + resource_group_name=resource_group.name, + location="str", + parameters={ + "crossRegionRestoreDetails": {"sourceBackupInstanceId": "str", "sourceRegion": "str"}, + "restoreRequestObject": "azure_backup_restore_request", + }, + api_version="2025-02-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_instances_begin_validate_cross_region_restore(self, resource_group): + response = await ( + await self.client.backup_instances.begin_validate_cross_region_restore( + resource_group_name=resource_group.name, + location="str", + parameters={ + "crossRegionRestoreDetails": {"sourceBackupInstanceId": "str", "sourceRegion": "str"}, + "restoreRequestObject": "azure_backup_restore_request", + }, + api_version="2025-02-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_instances_begin_trigger_rehydrate(self, resource_group): + response = await ( + await self.client.backup_instances.begin_trigger_rehydrate( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + parameters={ + "recoveryPointId": "str", + "rehydrationRetentionDuration": "str", + "rehydrationPriority": "str", + }, + api_version="2025-02-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_instances_begin_trigger_restore(self, resource_group): + response = await ( + await self.client.backup_instances.begin_trigger_restore( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + parameters={ + "objectType": "AzureBackupRestoreWithRehydrationRequest", + "recoveryPointId": "str", + "rehydrationPriority": "str", + "rehydrationRetentionDuration": "str", + "restoreTargetInfo": "restore_target_info_base", + "sourceDataStoreType": "str", + "identityDetails": {"useSystemAssignedIdentity": bool, "userAssignedIdentityArmUrl": "str"}, + "resourceGuardOperationRequests": ["str"], + "sourceResourceId": "str", + }, + api_version="2025-02-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_instances_begin_resume_backups(self, resource_group): + response = await ( + await self.client.backup_instances.begin_resume_backups( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + api_version="2025-02-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_instances_begin_resume_protection(self, resource_group): + response = await ( + await self.client.backup_instances.begin_resume_protection( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + api_version="2025-02-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_instances_begin_stop_protection(self, resource_group): + response = await ( + await self.client.backup_instances.begin_stop_protection( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + api_version="2025-02-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_instances_begin_suspend_backups(self, resource_group): + response = await ( + await self.client.backup_instances.begin_suspend_backups( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + api_version="2025-02-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_instances_begin_sync_backup_instance(self, resource_group): + response = await ( + await self.client.backup_instances.begin_sync_backup_instance( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + parameters={"syncType": "str"}, + api_version="2025-02-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_instances_begin_validate_for_restore(self, resource_group): + response = await ( + await self.client.backup_instances.begin_validate_for_restore( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + parameters={"restoreRequestObject": "azure_backup_restore_request"}, + api_version="2025-02-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_backup_policies_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_backup_policies_operations.py new file mode 100644 index 000000000000..550afa32f815 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_backup_policies_operations.py @@ -0,0 +1,84 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection import DataProtectionMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionMgmtBackupPoliciesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_policies_list(self, resource_group): + response = self.client.backup_policies.list( + resource_group_name=resource_group.name, + vault_name="str", + api_version="2025-02-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_policies_get(self, resource_group): + response = self.client.backup_policies.get( + resource_group_name=resource_group.name, + vault_name="str", + backup_policy_name="str", + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_policies_create_or_update(self, resource_group): + response = self.client.backup_policies.create_or_update( + resource_group_name=resource_group.name, + vault_name="str", + backup_policy_name="str", + parameters={ + "id": "str", + "name": "str", + "properties": "base_backup_policy", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_policies_delete(self, resource_group): + response = self.client.backup_policies.delete( + resource_group_name=resource_group.name, + vault_name="str", + backup_policy_name="str", + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_backup_policies_operations_async.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_backup_policies_operations_async.py new file mode 100644 index 000000000000..2f407015c2ae --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_backup_policies_operations_async.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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection.aio import DataProtectionMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionMgmtBackupPoliciesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_policies_list(self, resource_group): + response = self.client.backup_policies.list( + resource_group_name=resource_group.name, + vault_name="str", + api_version="2025-02-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_policies_get(self, resource_group): + response = await self.client.backup_policies.get( + resource_group_name=resource_group.name, + vault_name="str", + backup_policy_name="str", + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_policies_create_or_update(self, resource_group): + response = await self.client.backup_policies.create_or_update( + resource_group_name=resource_group.name, + vault_name="str", + backup_policy_name="str", + parameters={ + "id": "str", + "name": "str", + "properties": "base_backup_policy", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_policies_delete(self, resource_group): + response = await self.client.backup_policies.delete( + resource_group_name=resource_group.name, + vault_name="str", + backup_policy_name="str", + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_backup_vault_operation_results_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_backup_vault_operation_results_operations.py new file mode 100644 index 000000000000..05a384f92a0b --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_backup_vault_operation_results_operations.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection import DataProtectionMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionMgmtBackupVaultOperationResultsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_vault_operation_results_get(self, resource_group): + response = self.client.backup_vault_operation_results.get( + resource_group_name=resource_group.name, + vault_name="str", + operation_id="str", + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_backup_vault_operation_results_operations_async.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_backup_vault_operation_results_operations_async.py new file mode 100644 index 000000000000..8a4c3a8987bf --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_backup_vault_operation_results_operations_async.py @@ -0,0 +1,33 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection.aio import DataProtectionMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionMgmtBackupVaultOperationResultsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_vault_operation_results_get(self, resource_group): + response = await self.client.backup_vault_operation_results.get( + resource_group_name=resource_group.name, + vault_name="str", + operation_id="str", + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_backup_vaults_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_backup_vaults_operations.py new file mode 100644 index 000000000000..ec77260ffebc --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_backup_vaults_operations.py @@ -0,0 +1,182 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection import DataProtectionMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionMgmtBackupVaultsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_vaults_get_in_subscription(self, resource_group): + response = self.client.backup_vaults.get_in_subscription( + api_version="2025-02-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_vaults_get_in_resource_group(self, resource_group): + response = self.client.backup_vaults.get_in_resource_group( + resource_group_name=resource_group.name, + api_version="2025-02-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_vaults_get(self, resource_group): + response = self.client.backup_vaults.get( + resource_group_name=resource_group.name, + vault_name="str", + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_vaults_begin_create_or_update(self, resource_group): + response = self.client.backup_vaults.begin_create_or_update( + resource_group_name=resource_group.name, + vault_name="str", + parameters={ + "properties": { + "storageSettings": [{"datastoreType": "str", "type": "str"}], + "bcdrSecurityLevel": "str", + "featureSettings": { + "crossRegionRestoreSettings": {"state": "str"}, + "crossSubscriptionRestoreSettings": {"state": "str"}, + }, + "isVaultProtectedByResourceGuard": bool, + "monitoringSettings": {"azureMonitorAlertSettings": {"alertsForAllJobFailures": "str"}}, + "provisioningState": "str", + "replicatedRegions": ["str"], + "resourceGuardOperationRequests": ["str"], + "resourceMoveDetails": { + "completionTimeUtc": "str", + "operationId": "str", + "sourceResourcePath": "str", + "startTimeUtc": "str", + "targetResourcePath": "str", + }, + "resourceMoveState": "str", + "secureScore": "str", + "securitySettings": { + "encryptionSettings": { + "infrastructureEncryption": "str", + "kekIdentity": {"identityId": "str", "identityType": "str"}, + "keyVaultProperties": {"keyUri": "str"}, + "state": "str", + }, + "immutabilitySettings": {"state": "str"}, + "softDeleteSettings": {"retentionDurationInDays": 0.0, "state": "str"}, + }, + }, + "eTag": "str", + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2025-02-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_vaults_begin_delete(self, resource_group): + response = self.client.backup_vaults.begin_delete( + resource_group_name=resource_group.name, + vault_name="str", + api_version="2025-02-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_vaults_begin_update(self, resource_group): + response = self.client.backup_vaults.begin_update( + resource_group_name=resource_group.name, + vault_name="str", + parameters={ + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "properties": { + "featureSettings": { + "crossRegionRestoreSettings": {"state": "str"}, + "crossSubscriptionRestoreSettings": {"state": "str"}, + }, + "monitoringSettings": {"azureMonitorAlertSettings": {"alertsForAllJobFailures": "str"}}, + "resourceGuardOperationRequests": ["str"], + "securitySettings": { + "encryptionSettings": { + "infrastructureEncryption": "str", + "kekIdentity": {"identityId": "str", "identityType": "str"}, + "keyVaultProperties": {"keyUri": "str"}, + "state": "str", + }, + "immutabilitySettings": {"state": "str"}, + "softDeleteSettings": {"retentionDurationInDays": 0.0, "state": "str"}, + }, + }, + "tags": {"str": "str"}, + }, + api_version="2025-02-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_vaults_check_name_availability(self, resource_group): + response = self.client.backup_vaults.check_name_availability( + resource_group_name=resource_group.name, + location="str", + parameters={"name": "str", "type": "str"}, + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_backup_vaults_operations_async.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_backup_vaults_operations_async.py new file mode 100644 index 000000000000..d897fc8e5d32 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_backup_vaults_operations_async.py @@ -0,0 +1,189 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection.aio import DataProtectionMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionMgmtBackupVaultsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_vaults_get_in_subscription(self, resource_group): + response = self.client.backup_vaults.get_in_subscription( + api_version="2025-02-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_vaults_get_in_resource_group(self, resource_group): + response = self.client.backup_vaults.get_in_resource_group( + resource_group_name=resource_group.name, + api_version="2025-02-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_vaults_get(self, resource_group): + response = await self.client.backup_vaults.get( + resource_group_name=resource_group.name, + vault_name="str", + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_vaults_begin_create_or_update(self, resource_group): + response = await ( + await self.client.backup_vaults.begin_create_or_update( + resource_group_name=resource_group.name, + vault_name="str", + parameters={ + "properties": { + "storageSettings": [{"datastoreType": "str", "type": "str"}], + "bcdrSecurityLevel": "str", + "featureSettings": { + "crossRegionRestoreSettings": {"state": "str"}, + "crossSubscriptionRestoreSettings": {"state": "str"}, + }, + "isVaultProtectedByResourceGuard": bool, + "monitoringSettings": {"azureMonitorAlertSettings": {"alertsForAllJobFailures": "str"}}, + "provisioningState": "str", + "replicatedRegions": ["str"], + "resourceGuardOperationRequests": ["str"], + "resourceMoveDetails": { + "completionTimeUtc": "str", + "operationId": "str", + "sourceResourcePath": "str", + "startTimeUtc": "str", + "targetResourcePath": "str", + }, + "resourceMoveState": "str", + "secureScore": "str", + "securitySettings": { + "encryptionSettings": { + "infrastructureEncryption": "str", + "kekIdentity": {"identityId": "str", "identityType": "str"}, + "keyVaultProperties": {"keyUri": "str"}, + "state": "str", + }, + "immutabilitySettings": {"state": "str"}, + "softDeleteSettings": {"retentionDurationInDays": 0.0, "state": "str"}, + }, + }, + "eTag": "str", + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2025-02-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_vaults_begin_delete(self, resource_group): + response = await ( + await self.client.backup_vaults.begin_delete( + resource_group_name=resource_group.name, + vault_name="str", + api_version="2025-02-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_vaults_begin_update(self, resource_group): + response = await ( + await self.client.backup_vaults.begin_update( + resource_group_name=resource_group.name, + vault_name="str", + parameters={ + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "properties": { + "featureSettings": { + "crossRegionRestoreSettings": {"state": "str"}, + "crossSubscriptionRestoreSettings": {"state": "str"}, + }, + "monitoringSettings": {"azureMonitorAlertSettings": {"alertsForAllJobFailures": "str"}}, + "resourceGuardOperationRequests": ["str"], + "securitySettings": { + "encryptionSettings": { + "infrastructureEncryption": "str", + "kekIdentity": {"identityId": "str", "identityType": "str"}, + "keyVaultProperties": {"keyUri": "str"}, + "state": "str", + }, + "immutabilitySettings": {"state": "str"}, + "softDeleteSettings": {"retentionDurationInDays": 0.0, "state": "str"}, + }, + }, + "tags": {"str": "str"}, + }, + api_version="2025-02-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_vaults_check_name_availability(self, resource_group): + response = await self.client.backup_vaults.check_name_availability( + resource_group_name=resource_group.name, + location="str", + parameters={"name": "str", "type": "str"}, + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_data_protection_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_data_protection_operations.py new file mode 100644 index 000000000000..ded972da80ed --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_data_protection_operations.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection import DataProtectionMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionMgmtDataProtectionOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_data_protection_check_feature_support(self, resource_group): + response = self.client.data_protection.check_feature_support( + location="str", + parameters={"objectType": "FeatureValidationRequest", "featureName": "str", "featureType": "str"}, + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_data_protection_operations_async.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_data_protection_operations_async.py new file mode 100644 index 000000000000..1ca17b63269a --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_data_protection_operations_async.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection.aio import DataProtectionMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionMgmtDataProtectionOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_data_protection_check_feature_support(self, resource_group): + response = await self.client.data_protection.check_feature_support( + location="str", + parameters={"objectType": "FeatureValidationRequest", "featureName": "str", "featureType": "str"}, + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_data_protection_operations_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_data_protection_operations_operations.py new file mode 100644 index 000000000000..958fad985b6e --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_data_protection_operations_operations.py @@ -0,0 +1,29 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection import DataProtectionMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionMgmtDataProtectionOperationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_data_protection_operations_list(self, resource_group): + response = self.client.data_protection_operations.list( + api_version="2025-02-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_data_protection_operations_operations_async.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_data_protection_operations_operations_async.py new file mode 100644 index 000000000000..ea78139b4b71 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_data_protection_operations_operations_async.py @@ -0,0 +1,30 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection.aio import DataProtectionMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionMgmtDataProtectionOperationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_data_protection_operations_list(self, resource_group): + response = self.client.data_protection_operations.list( + api_version="2025-02-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_deleted_backup_instances_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_deleted_backup_instances_operations.py new file mode 100644 index 000000000000..f48c36f40b73 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_deleted_backup_instances_operations.py @@ -0,0 +1,57 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection import DataProtectionMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionMgmtDeletedBackupInstancesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_deleted_backup_instances_list(self, resource_group): + response = self.client.deleted_backup_instances.list( + resource_group_name=resource_group.name, + vault_name="str", + api_version="2025-02-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_deleted_backup_instances_get(self, resource_group): + response = self.client.deleted_backup_instances.get( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_deleted_backup_instances_begin_undelete(self, resource_group): + response = self.client.deleted_backup_instances.begin_undelete( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + api_version="2025-02-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_deleted_backup_instances_operations_async.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_deleted_backup_instances_operations_async.py new file mode 100644 index 000000000000..bd9c3c043621 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_deleted_backup_instances_operations_async.py @@ -0,0 +1,60 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection.aio import DataProtectionMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionMgmtDeletedBackupInstancesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_deleted_backup_instances_list(self, resource_group): + response = self.client.deleted_backup_instances.list( + resource_group_name=resource_group.name, + vault_name="str", + api_version="2025-02-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_deleted_backup_instances_get(self, resource_group): + response = await self.client.deleted_backup_instances.get( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_deleted_backup_instances_begin_undelete(self, resource_group): + response = await ( + await self.client.deleted_backup_instances.begin_undelete( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + api_version="2025-02-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_dpp_resource_guard_proxy_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_dpp_resource_guard_proxy_operations.py new file mode 100644 index 000000000000..e53ce462bdc6 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_dpp_resource_guard_proxy_operations.py @@ -0,0 +1,105 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection import DataProtectionMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionMgmtDppResourceGuardProxyOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_dpp_resource_guard_proxy_list(self, resource_group): + response = self.client.dpp_resource_guard_proxy.list( + resource_group_name=resource_group.name, + vault_name="str", + api_version="2025-02-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_dpp_resource_guard_proxy_get(self, resource_group): + response = self.client.dpp_resource_guard_proxy.get( + resource_group_name=resource_group.name, + vault_name="str", + resource_guard_proxy_name="str", + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_dpp_resource_guard_proxy_create_or_update(self, resource_group): + response = self.client.dpp_resource_guard_proxy.create_or_update( + resource_group_name=resource_group.name, + vault_name="str", + resource_guard_proxy_name="str", + parameters={ + "id": "str", + "name": "str", + "properties": { + "description": "str", + "lastUpdatedTime": "str", + "resourceGuardOperationDetails": [ + {"defaultResourceRequest": "str", "vaultCriticalOperation": "str"} + ], + "resourceGuardResourceId": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_dpp_resource_guard_proxy_delete(self, resource_group): + response = self.client.dpp_resource_guard_proxy.delete( + resource_group_name=resource_group.name, + vault_name="str", + resource_guard_proxy_name="str", + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_dpp_resource_guard_proxy_unlock_delete(self, resource_group): + response = self.client.dpp_resource_guard_proxy.unlock_delete( + resource_group_name=resource_group.name, + vault_name="str", + resource_guard_proxy_name="str", + parameters={"resourceGuardOperationRequests": ["str"], "resourceToBeDeleted": "str"}, + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_dpp_resource_guard_proxy_operations_async.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_dpp_resource_guard_proxy_operations_async.py new file mode 100644 index 000000000000..da0b40afe124 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_dpp_resource_guard_proxy_operations_async.py @@ -0,0 +1,106 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection.aio import DataProtectionMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionMgmtDppResourceGuardProxyOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_dpp_resource_guard_proxy_list(self, resource_group): + response = self.client.dpp_resource_guard_proxy.list( + resource_group_name=resource_group.name, + vault_name="str", + api_version="2025-02-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_dpp_resource_guard_proxy_get(self, resource_group): + response = await self.client.dpp_resource_guard_proxy.get( + resource_group_name=resource_group.name, + vault_name="str", + resource_guard_proxy_name="str", + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_dpp_resource_guard_proxy_create_or_update(self, resource_group): + response = await self.client.dpp_resource_guard_proxy.create_or_update( + resource_group_name=resource_group.name, + vault_name="str", + resource_guard_proxy_name="str", + parameters={ + "id": "str", + "name": "str", + "properties": { + "description": "str", + "lastUpdatedTime": "str", + "resourceGuardOperationDetails": [ + {"defaultResourceRequest": "str", "vaultCriticalOperation": "str"} + ], + "resourceGuardResourceId": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_dpp_resource_guard_proxy_delete(self, resource_group): + response = await self.client.dpp_resource_guard_proxy.delete( + resource_group_name=resource_group.name, + vault_name="str", + resource_guard_proxy_name="str", + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_dpp_resource_guard_proxy_unlock_delete(self, resource_group): + response = await self.client.dpp_resource_guard_proxy.unlock_delete( + resource_group_name=resource_group.name, + vault_name="str", + resource_guard_proxy_name="str", + parameters={"resourceGuardOperationRequests": ["str"], "resourceToBeDeleted": "str"}, + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_export_jobs_operation_result_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_export_jobs_operation_result_operations.py new file mode 100644 index 000000000000..4514da6b81f5 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_export_jobs_operation_result_operations.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection import DataProtectionMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionMgmtExportJobsOperationResultOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_export_jobs_operation_result_get(self, resource_group): + response = self.client.export_jobs_operation_result.get( + resource_group_name=resource_group.name, + vault_name="str", + operation_id="str", + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_export_jobs_operation_result_operations_async.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_export_jobs_operation_result_operations_async.py new file mode 100644 index 000000000000..17dac9f0ae5c --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_export_jobs_operation_result_operations_async.py @@ -0,0 +1,33 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection.aio import DataProtectionMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionMgmtExportJobsOperationResultOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_export_jobs_operation_result_get(self, resource_group): + response = await self.client.export_jobs_operation_result.get( + resource_group_name=resource_group.name, + vault_name="str", + operation_id="str", + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_export_jobs_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_export_jobs_operations.py new file mode 100644 index 000000000000..86e6aa239c28 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_export_jobs_operations.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection import DataProtectionMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionMgmtExportJobsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_export_jobs_begin_trigger(self, resource_group): + response = self.client.export_jobs.begin_trigger( + resource_group_name=resource_group.name, + vault_name="str", + api_version="2025-02-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_export_jobs_operations_async.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_export_jobs_operations_async.py new file mode 100644 index 000000000000..3551cb950b98 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_export_jobs_operations_async.py @@ -0,0 +1,34 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection.aio import DataProtectionMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionMgmtExportJobsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_export_jobs_begin_trigger(self, resource_group): + response = await ( + await self.client.export_jobs.begin_trigger( + resource_group_name=resource_group.name, + vault_name="str", + api_version="2025-02-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_fetch_cross_region_restore_job_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_fetch_cross_region_restore_job_operations.py new file mode 100644 index 000000000000..9ab72d59ec85 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_fetch_cross_region_restore_job_operations.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection import DataProtectionMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionMgmtFetchCrossRegionRestoreJobOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_fetch_cross_region_restore_job_get(self, resource_group): + response = self.client.fetch_cross_region_restore_job.get( + resource_group_name=resource_group.name, + location="str", + parameters={"jobId": "str", "sourceBackupVaultId": "str", "sourceRegion": "str"}, + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_fetch_cross_region_restore_job_operations_async.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_fetch_cross_region_restore_job_operations_async.py new file mode 100644 index 000000000000..a2aefead6557 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_fetch_cross_region_restore_job_operations_async.py @@ -0,0 +1,33 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection.aio import DataProtectionMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionMgmtFetchCrossRegionRestoreJobOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_fetch_cross_region_restore_job_get(self, resource_group): + response = await self.client.fetch_cross_region_restore_job.get( + resource_group_name=resource_group.name, + location="str", + parameters={"jobId": "str", "sourceBackupVaultId": "str", "sourceRegion": "str"}, + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_fetch_cross_region_restore_jobs_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_fetch_cross_region_restore_jobs_operations.py new file mode 100644 index 000000000000..dc7e7e32a041 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_fetch_cross_region_restore_jobs_operations.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection import DataProtectionMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionMgmtFetchCrossRegionRestoreJobsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_fetch_cross_region_restore_jobs_list(self, resource_group): + response = self.client.fetch_cross_region_restore_jobs.list( + resource_group_name=resource_group.name, + location="str", + parameters={"sourceBackupVaultId": "str", "sourceRegion": "str"}, + api_version="2025-02-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_fetch_cross_region_restore_jobs_operations_async.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_fetch_cross_region_restore_jobs_operations_async.py new file mode 100644 index 000000000000..ca629d17741d --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_fetch_cross_region_restore_jobs_operations_async.py @@ -0,0 +1,33 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection.aio import DataProtectionMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionMgmtFetchCrossRegionRestoreJobsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_fetch_cross_region_restore_jobs_list(self, resource_group): + response = self.client.fetch_cross_region_restore_jobs.list( + resource_group_name=resource_group.name, + location="str", + parameters={"sourceBackupVaultId": "str", "sourceRegion": "str"}, + api_version="2025-02-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_fetch_secondary_recovery_points_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_fetch_secondary_recovery_points_operations.py new file mode 100644 index 000000000000..ece4240b7ced --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_fetch_secondary_recovery_points_operations.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection import DataProtectionMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionMgmtFetchSecondaryRecoveryPointsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_fetch_secondary_recovery_points_list(self, resource_group): + response = self.client.fetch_secondary_recovery_points.list( + resource_group_name=resource_group.name, + location="str", + parameters={"sourceBackupInstanceId": "str", "sourceRegion": "str"}, + api_version="2025-02-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_fetch_secondary_recovery_points_operations_async.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_fetch_secondary_recovery_points_operations_async.py new file mode 100644 index 000000000000..65c900900376 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_fetch_secondary_recovery_points_operations_async.py @@ -0,0 +1,33 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection.aio import DataProtectionMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionMgmtFetchSecondaryRecoveryPointsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_fetch_secondary_recovery_points_list(self, resource_group): + response = self.client.fetch_secondary_recovery_points.list( + resource_group_name=resource_group.name, + location="str", + parameters={"sourceBackupInstanceId": "str", "sourceRegion": "str"}, + api_version="2025-02-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_jobs_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_jobs_operations.py new file mode 100644 index 000000000000..47e110b2f795 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_jobs_operations.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection import DataProtectionMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionMgmtJobsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_jobs_list(self, resource_group): + response = self.client.jobs.list( + resource_group_name=resource_group.name, + vault_name="str", + api_version="2025-02-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_jobs_get(self, resource_group): + response = self.client.jobs.get( + resource_group_name=resource_group.name, + vault_name="str", + job_id="str", + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_jobs_operations_async.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_jobs_operations_async.py new file mode 100644 index 000000000000..83af00c666dd --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_jobs_operations_async.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection.aio import DataProtectionMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionMgmtJobsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_jobs_list(self, resource_group): + response = self.client.jobs.list( + resource_group_name=resource_group.name, + vault_name="str", + api_version="2025-02-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_jobs_get(self, resource_group): + response = await self.client.jobs.get( + resource_group_name=resource_group.name, + vault_name="str", + job_id="str", + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_operation_result_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_operation_result_operations.py new file mode 100644 index 000000000000..bd5a6d6981c5 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_operation_result_operations.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection import DataProtectionMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionMgmtOperationResultOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_operation_result_get(self, resource_group): + response = self.client.operation_result.get( + operation_id="str", + location="str", + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_operation_result_operations_async.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_operation_result_operations_async.py new file mode 100644 index 000000000000..032cac55d045 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_operation_result_operations_async.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection.aio import DataProtectionMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionMgmtOperationResultOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_operation_result_get(self, resource_group): + response = await self.client.operation_result.get( + operation_id="str", + location="str", + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_operation_status_backup_vault_context_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_operation_status_backup_vault_context_operations.py new file mode 100644 index 000000000000..a13522120bcf --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_operation_status_backup_vault_context_operations.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection import DataProtectionMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionMgmtOperationStatusBackupVaultContextOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_operation_status_backup_vault_context_get(self, resource_group): + response = self.client.operation_status_backup_vault_context.get( + resource_group_name=resource_group.name, + vault_name="str", + operation_id="str", + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_operation_status_backup_vault_context_operations_async.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_operation_status_backup_vault_context_operations_async.py new file mode 100644 index 000000000000..ebfcc9691b9d --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_operation_status_backup_vault_context_operations_async.py @@ -0,0 +1,33 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection.aio import DataProtectionMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionMgmtOperationStatusBackupVaultContextOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_operation_status_backup_vault_context_get(self, resource_group): + response = await self.client.operation_status_backup_vault_context.get( + resource_group_name=resource_group.name, + vault_name="str", + operation_id="str", + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_operation_status_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_operation_status_operations.py new file mode 100644 index 000000000000..b0e56573897e --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_operation_status_operations.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection import DataProtectionMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionMgmtOperationStatusOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_operation_status_get(self, resource_group): + response = self.client.operation_status.get( + location="str", + operation_id="str", + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_operation_status_operations_async.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_operation_status_operations_async.py new file mode 100644 index 000000000000..051a0f41c710 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_operation_status_operations_async.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection.aio import DataProtectionMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionMgmtOperationStatusOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_operation_status_get(self, resource_group): + response = await self.client.operation_status.get( + location="str", + operation_id="str", + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_operation_status_resource_group_context_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_operation_status_resource_group_context_operations.py new file mode 100644 index 000000000000..95252e39f7ec --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_operation_status_resource_group_context_operations.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection import DataProtectionMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionMgmtOperationStatusResourceGroupContextOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_operation_status_resource_group_context_get(self, resource_group): + response = self.client.operation_status_resource_group_context.get( + resource_group_name=resource_group.name, + operation_id="str", + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_operation_status_resource_group_context_operations_async.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_operation_status_resource_group_context_operations_async.py new file mode 100644 index 000000000000..5949d14cb625 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_operation_status_resource_group_context_operations_async.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection.aio import DataProtectionMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionMgmtOperationStatusResourceGroupContextOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_operation_status_resource_group_context_get(self, resource_group): + response = await self.client.operation_status_resource_group_context.get( + resource_group_name=resource_group.name, + operation_id="str", + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_recovery_points_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_recovery_points_operations.py new file mode 100644 index 000000000000..cd835acaa273 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_recovery_points_operations.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection import DataProtectionMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionMgmtRecoveryPointsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_recovery_points_list(self, resource_group): + response = self.client.recovery_points.list( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + api_version="2025-02-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_recovery_points_get(self, resource_group): + response = self.client.recovery_points.get( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + recovery_point_id="str", + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_recovery_points_operations_async.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_recovery_points_operations_async.py new file mode 100644 index 000000000000..1e2bdc9acaeb --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_recovery_points_operations_async.py @@ -0,0 +1,47 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection.aio import DataProtectionMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionMgmtRecoveryPointsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_recovery_points_list(self, resource_group): + response = self.client.recovery_points.list( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + api_version="2025-02-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_recovery_points_get(self, resource_group): + response = await self.client.recovery_points.get( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + recovery_point_id="str", + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_resource_guards_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_resource_guards_operations.py new file mode 100644 index 000000000000..f3675081ab44 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_resource_guards_operations.py @@ -0,0 +1,262 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection import DataProtectionMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionMgmtResourceGuardsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_resource_guards_get_resources_in_subscription(self, resource_group): + response = self.client.resource_guards.get_resources_in_subscription( + api_version="2025-02-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_resource_guards_get_resources_in_resource_group(self, resource_group): + response = self.client.resource_guards.get_resources_in_resource_group( + resource_group_name=resource_group.name, + api_version="2025-02-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_resource_guards_put(self, resource_group): + response = self.client.resource_guards.put( + resource_group_name=resource_group.name, + resource_guards_name="str", + parameters={ + "eTag": "str", + "id": "str", + "location": "str", + "name": "str", + "properties": { + "allowAutoApprovals": bool, + "description": "str", + "provisioningState": "str", + "resourceGuardOperations": [{"requestResourceType": "str", "vaultCriticalOperation": "str"}], + "vaultCriticalOperationExclusionList": ["str"], + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_resource_guards_get(self, resource_group): + response = self.client.resource_guards.get( + resource_group_name=resource_group.name, + resource_guards_name="str", + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_resource_guards_delete(self, resource_group): + response = self.client.resource_guards.delete( + resource_group_name=resource_group.name, + resource_guards_name="str", + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_resource_guards_patch(self, resource_group): + response = self.client.resource_guards.patch( + resource_group_name=resource_group.name, + resource_guards_name="str", + parameters={"tags": {"str": "str"}}, + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_resource_guards_get_disable_soft_delete_requests_objects(self, resource_group): + response = self.client.resource_guards.get_disable_soft_delete_requests_objects( + resource_group_name=resource_group.name, + resource_guards_name="str", + api_version="2025-02-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_resource_guards_get_delete_resource_guard_proxy_requests_objects(self, resource_group): + response = self.client.resource_guards.get_delete_resource_guard_proxy_requests_objects( + resource_group_name=resource_group.name, + resource_guards_name="str", + api_version="2025-02-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_resource_guards_get_backup_security_pin_requests_objects(self, resource_group): + response = self.client.resource_guards.get_backup_security_pin_requests_objects( + resource_group_name=resource_group.name, + resource_guards_name="str", + api_version="2025-02-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_resource_guards_get_delete_protected_item_requests_objects(self, resource_group): + response = self.client.resource_guards.get_delete_protected_item_requests_objects( + resource_group_name=resource_group.name, + resource_guards_name="str", + api_version="2025-02-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_resource_guards_get_update_protection_policy_requests_objects(self, resource_group): + response = self.client.resource_guards.get_update_protection_policy_requests_objects( + resource_group_name=resource_group.name, + resource_guards_name="str", + api_version="2025-02-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_resource_guards_get_update_protected_item_requests_objects(self, resource_group): + response = self.client.resource_guards.get_update_protected_item_requests_objects( + resource_group_name=resource_group.name, + resource_guards_name="str", + api_version="2025-02-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_resource_guards_get_default_disable_soft_delete_requests_object(self, resource_group): + response = self.client.resource_guards.get_default_disable_soft_delete_requests_object( + resource_group_name=resource_group.name, + resource_guards_name="str", + request_name="str", + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_resource_guards_get_default_delete_resource_guard_proxy_requests_object(self, resource_group): + response = self.client.resource_guards.get_default_delete_resource_guard_proxy_requests_object( + resource_group_name=resource_group.name, + resource_guards_name="str", + request_name="str", + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_resource_guards_get_default_backup_security_pin_requests_object(self, resource_group): + response = self.client.resource_guards.get_default_backup_security_pin_requests_object( + resource_group_name=resource_group.name, + resource_guards_name="str", + request_name="str", + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_resource_guards_get_default_delete_protected_item_requests_object(self, resource_group): + response = self.client.resource_guards.get_default_delete_protected_item_requests_object( + resource_group_name=resource_group.name, + resource_guards_name="str", + request_name="str", + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_resource_guards_get_default_update_protection_policy_requests_object(self, resource_group): + response = self.client.resource_guards.get_default_update_protection_policy_requests_object( + resource_group_name=resource_group.name, + resource_guards_name="str", + request_name="str", + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_resource_guards_get_default_update_protected_item_requests_object(self, resource_group): + response = self.client.resource_guards.get_default_update_protected_item_requests_object( + resource_group_name=resource_group.name, + resource_guards_name="str", + request_name="str", + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_resource_guards_operations_async.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_resource_guards_operations_async.py new file mode 100644 index 000000000000..e953112c0cc4 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_resource_guards_operations_async.py @@ -0,0 +1,263 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection.aio import DataProtectionMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionMgmtResourceGuardsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_resource_guards_get_resources_in_subscription(self, resource_group): + response = self.client.resource_guards.get_resources_in_subscription( + api_version="2025-02-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_resource_guards_get_resources_in_resource_group(self, resource_group): + response = self.client.resource_guards.get_resources_in_resource_group( + resource_group_name=resource_group.name, + api_version="2025-02-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_resource_guards_put(self, resource_group): + response = await self.client.resource_guards.put( + resource_group_name=resource_group.name, + resource_guards_name="str", + parameters={ + "eTag": "str", + "id": "str", + "location": "str", + "name": "str", + "properties": { + "allowAutoApprovals": bool, + "description": "str", + "provisioningState": "str", + "resourceGuardOperations": [{"requestResourceType": "str", "vaultCriticalOperation": "str"}], + "vaultCriticalOperationExclusionList": ["str"], + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_resource_guards_get(self, resource_group): + response = await self.client.resource_guards.get( + resource_group_name=resource_group.name, + resource_guards_name="str", + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_resource_guards_delete(self, resource_group): + response = await self.client.resource_guards.delete( + resource_group_name=resource_group.name, + resource_guards_name="str", + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_resource_guards_patch(self, resource_group): + response = await self.client.resource_guards.patch( + resource_group_name=resource_group.name, + resource_guards_name="str", + parameters={"tags": {"str": "str"}}, + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_resource_guards_get_disable_soft_delete_requests_objects(self, resource_group): + response = self.client.resource_guards.get_disable_soft_delete_requests_objects( + resource_group_name=resource_group.name, + resource_guards_name="str", + api_version="2025-02-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_resource_guards_get_delete_resource_guard_proxy_requests_objects(self, resource_group): + response = self.client.resource_guards.get_delete_resource_guard_proxy_requests_objects( + resource_group_name=resource_group.name, + resource_guards_name="str", + api_version="2025-02-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_resource_guards_get_backup_security_pin_requests_objects(self, resource_group): + response = self.client.resource_guards.get_backup_security_pin_requests_objects( + resource_group_name=resource_group.name, + resource_guards_name="str", + api_version="2025-02-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_resource_guards_get_delete_protected_item_requests_objects(self, resource_group): + response = self.client.resource_guards.get_delete_protected_item_requests_objects( + resource_group_name=resource_group.name, + resource_guards_name="str", + api_version="2025-02-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_resource_guards_get_update_protection_policy_requests_objects(self, resource_group): + response = self.client.resource_guards.get_update_protection_policy_requests_objects( + resource_group_name=resource_group.name, + resource_guards_name="str", + api_version="2025-02-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_resource_guards_get_update_protected_item_requests_objects(self, resource_group): + response = self.client.resource_guards.get_update_protected_item_requests_objects( + resource_group_name=resource_group.name, + resource_guards_name="str", + api_version="2025-02-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_resource_guards_get_default_disable_soft_delete_requests_object(self, resource_group): + response = await self.client.resource_guards.get_default_disable_soft_delete_requests_object( + resource_group_name=resource_group.name, + resource_guards_name="str", + request_name="str", + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_resource_guards_get_default_delete_resource_guard_proxy_requests_object(self, resource_group): + response = await self.client.resource_guards.get_default_delete_resource_guard_proxy_requests_object( + resource_group_name=resource_group.name, + resource_guards_name="str", + request_name="str", + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_resource_guards_get_default_backup_security_pin_requests_object(self, resource_group): + response = await self.client.resource_guards.get_default_backup_security_pin_requests_object( + resource_group_name=resource_group.name, + resource_guards_name="str", + request_name="str", + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_resource_guards_get_default_delete_protected_item_requests_object(self, resource_group): + response = await self.client.resource_guards.get_default_delete_protected_item_requests_object( + resource_group_name=resource_group.name, + resource_guards_name="str", + request_name="str", + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_resource_guards_get_default_update_protection_policy_requests_object(self, resource_group): + response = await self.client.resource_guards.get_default_update_protection_policy_requests_object( + resource_group_name=resource_group.name, + resource_guards_name="str", + request_name="str", + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_resource_guards_get_default_update_protected_item_requests_object(self, resource_group): + response = await self.client.resource_guards.get_default_update_protected_item_requests_object( + resource_group_name=resource_group.name, + resource_guards_name="str", + request_name="str", + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_restorable_time_ranges_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_restorable_time_ranges_operations.py new file mode 100644 index 000000000000..2eff28a6aff6 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_restorable_time_ranges_operations.py @@ -0,0 +1,33 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection import DataProtectionMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionMgmtRestorableTimeRangesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_restorable_time_ranges_find(self, resource_group): + response = self.client.restorable_time_ranges.find( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + parameters={"sourceDataStoreType": "str", "endTime": "str", "startTime": "str"}, + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_restorable_time_ranges_operations_async.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_restorable_time_ranges_operations_async.py new file mode 100644 index 000000000000..cd3b2af4e5d3 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_mgmt_restorable_time_ranges_operations_async.py @@ -0,0 +1,34 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection.aio import DataProtectionMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionMgmtRestorableTimeRangesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_restorable_time_ranges_find(self, resource_group): + response = await self.client.restorable_time_ranges.find( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + parameters={"sourceDataStoreType": "str", "endTime": "str", "startTime": "str"}, + api_version="2025-02-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/setup.py b/sdk/dataprotection/azure-mgmt-dataprotection/setup.py index c26d6e46ea8b..2e6612624983 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/setup.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/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", ],