From 84877bbfa01cadb7ad2d81a5c6fe9c4cab2b16a4 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 9 May 2023 06:06:56 +0000 Subject: [PATCH] CodeGen from PR 23391 in Azure/azure-rest-api-specs Merge dbb52b20c90aff2c8f8eba223c2e03bdd1dda832 into 5c021b26d815babdb06989b25fbb834cbbe7ba6b --- .../azure-mgmt-dataprotection/_meta.json | 6 +- .../mgmt/dataprotection/_configuration.py | 12 +- .../_data_protection_mgmt_client.py | 38 +- .../mgmt/dataprotection/_serialization.py | 6 +- .../azure/mgmt/dataprotection/_version.py | 2 +- .../mgmt/dataprotection/aio/_configuration.py | 12 +- .../aio/_data_protection_mgmt_client.py | 38 +- .../dataprotection/aio/operations/__init__.py | 10 + ..._instances_extension_routing_operations.py | 138 +++ .../_backup_instances_operations.py | 633 +++++++++++--- .../operations/_backup_policies_operations.py | 33 +- ...ckup_vault_operation_results_operations.py | 12 +- .../operations/_backup_vaults_operations.py | 66 +- .../_cross_region_restore_job_operations.py | 193 +++++ .../_cross_region_restore_jobs_operations.py | 227 +++++ .../operations/_data_protection_operations.py | 12 +- .../_data_protection_operations_operations.py | 12 +- .../_deleted_backup_instances_operations.py | 30 +- .../_dpp_resource_guard_proxy_operations.py | 607 ++++++++++++++ ...export_jobs_operation_result_operations.py | 12 +- .../aio/operations/_export_jobs_operations.py | 16 +- .../aio/operations/_jobs_operations.py | 19 +- .../_operation_result_operations.py | 12 +- ..._status_backup_vault_context_operations.py | 12 +- .../_operation_status_operations.py | 12 +- ...tatus_resource_group_context_operations.py | 12 +- .../operations/_recovery_points_operations.py | 19 +- .../operations/_resource_guards_operations.py | 151 ++-- .../_restorable_time_ranges_operations.py | 12 +- .../operations/_secondary_rps_operations.py | 250 ++++++ .../mgmt/dataprotection/models/__init__.py | 34 + .../_data_protection_mgmt_client_enums.py | 17 + .../mgmt/dataprotection/models/_models_py3.py | 602 +++++++++++++- .../dataprotection/operations/__init__.py | 10 + ..._instances_extension_routing_operations.py | 164 ++++ .../_backup_instances_operations.py | 735 +++++++++++++--- .../operations/_backup_policies_operations.py | 41 +- ...ckup_vault_operation_results_operations.py | 14 +- .../operations/_backup_vaults_operations.py | 80 +- .../_cross_region_restore_job_operations.py | 230 +++++ .../_cross_region_restore_jobs_operations.py | 261 ++++++ .../operations/_data_protection_operations.py | 14 +- .../_data_protection_operations_operations.py | 14 +- .../_deleted_backup_instances_operations.py | 36 +- .../_dpp_resource_guard_proxy_operations.py | 784 ++++++++++++++++++ ...export_jobs_operation_result_operations.py | 14 +- .../operations/_export_jobs_operations.py | 18 +- .../operations/_jobs_operations.py | 23 +- .../_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 | 23 +- .../operations/_resource_guards_operations.py | 217 +++-- .../_restorable_time_ranges_operations.py | 14 +- .../operations/_secondary_rps_operations.py | 299 +++++++ .../check_backup_vaults_name_availability.py | 2 +- .../generated_samples/checkfeature_support.py | 2 +- .../create_or_update_backup_policy.py | 2 +- .../delete_backup_instance.py | 2 +- .../generated_samples/delete_backup_policy.py | 2 +- .../generated_samples/delete_backup_vault.py | 2 +- .../delete_resource_guard.py | 2 +- .../delete_resource_guard_proxy.py | 42 + .../fetch_cross_region_restore_job.py | 46 + .../fetch_cross_region_restore_jobs.py | 46 + .../generated_samples/fetch_secondary_rps.py | 46 + .../find_restorable_time_ranges.py | 2 +- .../generated_samples/get_backup_instance.py | 2 +- .../get_backup_instance_operation_result.py | 2 +- .../generated_samples/get_backup_policy.py | 2 +- .../generated_samples/get_backup_vault.py | 2 +- .../get_backup_vault_with_msi.py | 2 +- .../get_backup_vaults_in_resource_group.py | 2 +- .../get_backup_vaults_in_subscription.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 +- .../get_deleted_backup_instance.py | 2 +- .../get_export_jobs_operation_result.py | 2 +- .../generated_samples/get_job.py | 2 +- .../generated_samples/get_operation_result.py | 2 +- .../get_operation_result_patch.py | 2 +- .../generated_samples/get_operation_status.py | 2 +- .../get_operation_status_rg_context.py | 2 +- .../get_operation_status_vault_context.py | 2 +- .../generated_samples/get_recovery_point.py | 2 +- .../generated_samples/get_resource_guard.py | 2 +- .../get_resource_guard_proxy.py | 42 + .../get_resource_guards_in_resource_group.py | 2 +- .../get_resource_guards_in_subscription.py | 2 +- .../generated_samples/list.py | 2 +- .../list_backup_instances.py | 2 +- ...list_backup_instances_extension_routing.py | 41 + .../generated_samples/list_backup_policy.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_deleted_backup_instances.py | 2 +- .../list_disable_soft_delete_requests.py | 2 +- .../generated_samples/list_jobs.py | 2 +- .../generated_samples/list_recovery_points.py | 2 +- .../list_resource_guard_proxy.py | 42 + .../list_update_protected_item_requests.py | 2 +- .../list_update_protection_policy_requests.py | 2 +- .../generated_samples/patch_backup_vault.py | 2 +- .../generated_samples/patch_resource_guard.py | 2 +- .../generated_samples/put_backup_instance.py | 2 +- .../generated_samples/put_backup_vault.py | 4 +- .../put_backup_vault_with_msi.py | 4 +- .../generated_samples/put_resource_guard.py | 2 +- .../put_resource_guard_proxy.py | 47 ++ .../generated_samples/resume_backups.py | 2 +- .../generated_samples/resume_protection.py | 2 +- .../generated_samples/stop_protection.py | 2 +- .../generated_samples/suspend_backups.py | 2 +- .../generated_samples/sync_backup_instance.py | 2 +- .../generated_samples/trigger_backup.py | 2 +- .../trigger_cross_region_restore.py | 83 ++ .../generated_samples/trigger_export_jobs.py | 2 +- .../generated_samples/trigger_rehydrate.py | 2 +- .../generated_samples/trigger_restore.py | 2 +- .../trigger_restore_as_files.py | 2 +- .../trigger_restore_with_rehydration.py | 2 +- .../undelete_deleted_backup_instance.py | 2 +- .../unlock_delete_resource_guard_proxy.py | 48 ++ .../validate_cross_region_restore.py | 83 ++ .../generated_samples/validate_for_backup.py | 2 +- .../generated_samples/validate_restore.py | 2 +- 132 files changed, 6059 insertions(+), 955 deletions(-) create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_instances_extension_routing_operations.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_cross_region_restore_job_operations.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_cross_region_restore_jobs_operations.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_dpp_resource_guard_proxy_operations.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_secondary_rps_operations.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_instances_extension_routing_operations.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_cross_region_restore_job_operations.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_cross_region_restore_jobs_operations.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_dpp_resource_guard_proxy_operations.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_secondary_rps_operations.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_resource_guard_proxy.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/fetch_cross_region_restore_job.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/fetch_cross_region_restore_jobs.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/fetch_secondary_rps.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_resource_guard_proxy.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_backup_instances_extension_routing.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_resource_guard_proxy.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_resource_guard_proxy.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_cross_region_restore.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/unlock_delete_resource_guard_proxy.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/validate_cross_region_restore.py diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/_meta.json b/sdk/dataprotection/azure-mgmt-dataprotection/_meta.json index 8d7e363a7fc9..2adf5e2b897b 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/_meta.json +++ b/sdk/dataprotection/azure-mgmt-dataprotection/_meta.json @@ -1,11 +1,11 @@ { - "commit": "96c583e9d5d09c51fe8a21843180c51b98b4a7db", + "commit": "29ba8a9ed2c638bb209f4b12a791a41d1fe74408", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.2", "use": [ - "@autorest/python@6.4.0", + "@autorest/python@6.4.8", "@autorest/modelerfour@4.24.3" ], - "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.4.0 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/dataprotection/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.4.8 --use=@autorest/modelerfour@4.24.3 --version=3.9.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/_configuration.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_configuration.py index a6ddb97a5063..221843c8ae15 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_configuration.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from ._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -35,14 +29,14 @@ class DataProtectionMgmtClientConfiguration(Configuration): # pylint: disable=t :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 "2023-01-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-04-01-preview". 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: super(DataProtectionMgmtClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", "2023-01-01") + api_version: str = kwargs.pop("api_version", "2023-04-01-preview") 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 04b5edb89829..8b1552457820 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 @@ -16,13 +16,17 @@ from ._configuration import DataProtectionMgmtClientConfiguration from ._serialization import Deserializer, Serializer from .operations import ( + BackupInstancesExtensionRoutingOperations, BackupInstancesOperations, BackupPoliciesOperations, BackupVaultOperationResultsOperations, BackupVaultsOperations, + CrossRegionRestoreJobOperations, + CrossRegionRestoreJobsOperations, DataProtectionOperations, DataProtectionOperationsOperations, DeletedBackupInstancesOperations, + DppResourceGuardProxyOperations, ExportJobsOperationResultOperations, ExportJobsOperations, JobsOperations, @@ -33,6 +37,7 @@ RecoveryPointsOperations, ResourceGuardsOperations, RestorableTimeRangesOperations, + SecondaryRPsOperations, ) if TYPE_CHECKING: @@ -71,6 +76,17 @@ class DataProtectionMgmtClient: # pylint: disable=client-accepts-api-version-ke :vartype backup_instances: azure.mgmt.dataprotection.operations.BackupInstancesOperations :ivar recovery_points: RecoveryPointsOperations operations :vartype recovery_points: azure.mgmt.dataprotection.operations.RecoveryPointsOperations + :ivar secondary_rps: SecondaryRPsOperations operations + :vartype secondary_rps: azure.mgmt.dataprotection.operations.SecondaryRPsOperations + :ivar cross_region_restore_job: CrossRegionRestoreJobOperations operations + :vartype cross_region_restore_job: + azure.mgmt.dataprotection.operations.CrossRegionRestoreJobOperations + :ivar cross_region_restore_jobs: CrossRegionRestoreJobsOperations operations + :vartype cross_region_restore_jobs: + azure.mgmt.dataprotection.operations.CrossRegionRestoreJobsOperations + :ivar backup_instances_extension_routing: BackupInstancesExtensionRoutingOperations operations + :vartype backup_instances_extension_routing: + azure.mgmt.dataprotection.operations.BackupInstancesExtensionRoutingOperations :ivar jobs: JobsOperations operations :vartype jobs: azure.mgmt.dataprotection.operations.JobsOperations :ivar restorable_time_ranges: RestorableTimeRangesOperations operations @@ -86,14 +102,17 @@ class DataProtectionMgmtClient: # pylint: disable=client-accepts-api-version-ke azure.mgmt.dataprotection.operations.DeletedBackupInstancesOperations :ivar resource_guards: ResourceGuardsOperations operations :vartype resource_guards: azure.mgmt.dataprotection.operations.ResourceGuardsOperations + :ivar dpp_resource_guard_proxy: DppResourceGuardProxyOperations operations + :vartype dpp_resource_guard_proxy: + azure.mgmt.dataprotection.operations.DppResourceGuardProxyOperations :param credential: Credential needed for the client to connect to Azure. Required. :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 :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2023-01-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-04-01-preview". 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 Retry-After header is present. @@ -109,7 +128,7 @@ def __init__( self._config = DataProtectionMgmtClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -140,6 +159,16 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.recovery_points = RecoveryPointsOperations(self._client, self._config, self._serialize, self._deserialize) + self.secondary_rps = SecondaryRPsOperations(self._client, self._config, self._serialize, self._deserialize) + self.cross_region_restore_job = CrossRegionRestoreJobOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.cross_region_restore_jobs = CrossRegionRestoreJobsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.backup_instances_extension_routing = BackupInstancesExtensionRoutingOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) self.restorable_time_ranges = RestorableTimeRangesOperations( self._client, self._config, self._serialize, self._deserialize @@ -152,6 +181,9 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.resource_guards = ResourceGuardsOperations(self._client, self._config, self._serialize, self._deserialize) + self.dpp_resource_guard_proxy = DppResourceGuardProxyOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. 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 f17c068e833e..842ae727fbbc 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_serialization.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_serialization.py @@ -629,7 +629,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if xml_desc.get("attr", False): if xml_ns: ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) serialized.set(xml_name, new_attr) # type: ignore continue if xml_desc.get("text", False): @@ -1271,7 +1271,7 @@ def _extract_name_from_internal_type(internal_type): xml_name = internal_type_xml_map.get("name", internal_type.__name__) xml_ns = internal_type_xml_map.get("ns", None) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) return xml_name @@ -1295,7 +1295,7 @@ def xml_key_extractor(attr, attr_desc, data): # Integrate namespace if necessary xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) # If it's an attribute, that's simple if xml_desc.get("attr", False): 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 c47f66669f1b..e5754a47ce68 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.0.0" +VERSION = "1.0.0b1" 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 189b81274d68..9f1bbf492574 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 @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from .._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -35,14 +29,14 @@ class DataProtectionMgmtClientConfiguration(Configuration): # pylint: disable=t :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 "2023-01-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-04-01-preview". 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: super(DataProtectionMgmtClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", "2023-01-01") + api_version: str = kwargs.pop("api_version", "2023-04-01-preview") 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 8a67b75527b2..b4f49d353308 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 @@ -16,13 +16,17 @@ from .._serialization import Deserializer, Serializer from ._configuration import DataProtectionMgmtClientConfiguration from .operations import ( + BackupInstancesExtensionRoutingOperations, BackupInstancesOperations, BackupPoliciesOperations, BackupVaultOperationResultsOperations, BackupVaultsOperations, + CrossRegionRestoreJobOperations, + CrossRegionRestoreJobsOperations, DataProtectionOperations, DataProtectionOperationsOperations, DeletedBackupInstancesOperations, + DppResourceGuardProxyOperations, ExportJobsOperationResultOperations, ExportJobsOperations, JobsOperations, @@ -33,6 +37,7 @@ RecoveryPointsOperations, ResourceGuardsOperations, RestorableTimeRangesOperations, + SecondaryRPsOperations, ) if TYPE_CHECKING: @@ -71,6 +76,17 @@ class DataProtectionMgmtClient: # pylint: disable=client-accepts-api-version-ke :vartype backup_instances: azure.mgmt.dataprotection.aio.operations.BackupInstancesOperations :ivar recovery_points: RecoveryPointsOperations operations :vartype recovery_points: azure.mgmt.dataprotection.aio.operations.RecoveryPointsOperations + :ivar secondary_rps: SecondaryRPsOperations operations + :vartype secondary_rps: azure.mgmt.dataprotection.aio.operations.SecondaryRPsOperations + :ivar cross_region_restore_job: CrossRegionRestoreJobOperations operations + :vartype cross_region_restore_job: + azure.mgmt.dataprotection.aio.operations.CrossRegionRestoreJobOperations + :ivar cross_region_restore_jobs: CrossRegionRestoreJobsOperations operations + :vartype cross_region_restore_jobs: + azure.mgmt.dataprotection.aio.operations.CrossRegionRestoreJobsOperations + :ivar backup_instances_extension_routing: BackupInstancesExtensionRoutingOperations operations + :vartype backup_instances_extension_routing: + azure.mgmt.dataprotection.aio.operations.BackupInstancesExtensionRoutingOperations :ivar jobs: JobsOperations operations :vartype jobs: azure.mgmt.dataprotection.aio.operations.JobsOperations :ivar restorable_time_ranges: RestorableTimeRangesOperations operations @@ -86,14 +102,17 @@ class DataProtectionMgmtClient: # pylint: disable=client-accepts-api-version-ke azure.mgmt.dataprotection.aio.operations.DeletedBackupInstancesOperations :ivar resource_guards: ResourceGuardsOperations operations :vartype resource_guards: azure.mgmt.dataprotection.aio.operations.ResourceGuardsOperations + :ivar dpp_resource_guard_proxy: DppResourceGuardProxyOperations operations + :vartype dpp_resource_guard_proxy: + azure.mgmt.dataprotection.aio.operations.DppResourceGuardProxyOperations :param credential: Credential needed for the client to connect to Azure. Required. :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 :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2023-01-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-04-01-preview". 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 Retry-After header is present. @@ -109,7 +128,7 @@ def __init__( self._config = DataProtectionMgmtClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -140,6 +159,16 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.recovery_points = RecoveryPointsOperations(self._client, self._config, self._serialize, self._deserialize) + self.secondary_rps = SecondaryRPsOperations(self._client, self._config, self._serialize, self._deserialize) + self.cross_region_restore_job = CrossRegionRestoreJobOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.cross_region_restore_jobs = CrossRegionRestoreJobsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.backup_instances_extension_routing = BackupInstancesExtensionRoutingOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) self.restorable_time_ranges = RestorableTimeRangesOperations( self._client, self._config, self._serialize, self._deserialize @@ -152,6 +181,9 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.resource_guards = ResourceGuardsOperations(self._client, self._config, self._serialize, self._deserialize) + self.dpp_resource_guard_proxy = DppResourceGuardProxyOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. 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 6775e75af5a7..cb814364d2ce 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 @@ -17,12 +17,17 @@ from ._backup_policies_operations import BackupPoliciesOperations from ._backup_instances_operations import BackupInstancesOperations from ._recovery_points_operations import RecoveryPointsOperations +from ._secondary_rps_operations import SecondaryRPsOperations +from ._cross_region_restore_job_operations import CrossRegionRestoreJobOperations +from ._cross_region_restore_jobs_operations import CrossRegionRestoreJobsOperations +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 ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -40,12 +45,17 @@ "BackupPoliciesOperations", "BackupInstancesOperations", "RecoveryPointsOperations", + "SecondaryRPsOperations", + "CrossRegionRestoreJobOperations", + "CrossRegionRestoreJobsOperations", + "BackupInstancesExtensionRoutingOperations", "JobsOperations", "RestorableTimeRangesOperations", "ExportJobsOperations", "ExportJobsOperationResultOperations", "DeletedBackupInstancesOperations", "ResourceGuardsOperations", + "DppResourceGuardProxyOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _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 new file mode 100644 index 000000000000..260cd5ba0315 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_instances_extension_routing_operations.py @@ -0,0 +1,138 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.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 + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class BackupInstancesExtensionRoutingOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.dataprotection.aio.DataProtectionMgmtClient`'s + :attr:`backup_instances_extension_routing` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, resource_id: str, **kwargs: Any) -> AsyncIterable["_models.BackupInstanceResource"]: + """Gets a list of backup instances associated with a tracked resource. + + :param resource_id: ARM path of the resource to be protected using Microsoft.DataProtection. + Required. + :type resource_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BackupInstanceResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.BackupInstanceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = 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)) + cls: ClsType[_models.BackupInstanceResourceList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_id=resource_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + 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 + + async def extract_data(pipeline_response): + deserialized = self._deserialize("BackupInstanceResourceList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + 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 [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/{resourceId}/providers/Microsoft.DataProtection/backupInstances"} 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 2578c16b4c71..f8a03a16ef50 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -43,16 +42,14 @@ build_stop_protection_request, build_suspend_backups_request, build_sync_backup_instance_request, + build_trigger_cross_region_restore_request, build_trigger_rehydrate_request, build_trigger_restore_request, + build_validate_cross_region_restore_request, build_validate_for_backup_request, build_validate_for_restore_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -97,9 +94,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -153,8 +148,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -199,9 +195,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BackupInstanceResource] = kwargs.pop("cls", None) request = build_get_request( @@ -217,8 +211,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -257,9 +252,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -287,8 +280,9 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -441,9 +435,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.BackupInstanceResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -503,9 +495,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -521,8 +511,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -574,9 +565,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) 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) @@ -636,9 +625,7 @@ async def _adhoc_backup_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -666,8 +653,9 @@ async def _adhoc_backup_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -818,9 +806,7 @@ async def begin_adhoc_backup( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.OperationJobExtendedInfo] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -884,9 +870,7 @@ async def _validate_for_backup_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -913,8 +897,9 @@ async def _validate_for_backup_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1056,9 +1041,7 @@ async def begin_validate_for_backup( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.OperationJobExtendedInfo] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -1134,9 +1117,7 @@ async def get_backup_instance_operation_result( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Optional[_models.BackupInstanceResource]] = kwargs.pop("cls", None) request = build_get_backup_instance_operation_result_request( @@ -1153,8 +1134,9 @@ async def get_backup_instance_operation_result( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1176,6 +1158,479 @@ async def get_backup_instance_operation_result( "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/operationResults/{operationId}" } + async def _trigger_cross_region_restore_initial( + self, + resource_group_name: str, + location: str, + parameters: Union[_models.CrossRegionRestoreRequestObject, IO], + **kwargs: Any + ) -> Optional[_models.OperationJobExtendedInfo]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CrossRegionRestoreRequestObject") + + request = build_trigger_cross_region_restore_request( + resource_group_name=resource_group_name, + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._trigger_cross_region_restore_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + 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 [200, 202]: + 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( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _trigger_cross_region_restore_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/locations/{location}/crossRegionRestore" + } + + @overload + async def begin_trigger_cross_region_restore( + self, + resource_group_name: str, + location: str, + parameters: _models.CrossRegionRestoreRequestObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: + """trigger_cross_region_restore. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: Required. + :type location: str + :param parameters: Request body for trigger CRR operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.CrossRegionRestoreRequestObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationJobExtendedInfo or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_trigger_cross_region_restore( + self, + resource_group_name: str, + location: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: + """trigger_cross_region_restore. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: Required. + :type location: str + :param parameters: Request body for trigger CRR operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationJobExtendedInfo or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_trigger_cross_region_restore( + self, + resource_group_name: str, + location: str, + parameters: Union[_models.CrossRegionRestoreRequestObject, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: + """trigger_cross_region_restore. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: Required. + :type location: str + :param parameters: Request body for trigger CRR operation. Is either a + CrossRegionRestoreRequestObject type or a IO type. Required. + :type parameters: ~azure.mgmt.dataprotection.models.CrossRegionRestoreRequestObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationJobExtendedInfo or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :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[_models.OperationJobExtendedInfo] = 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._trigger_cross_region_restore_initial( + resource_group_name=resource_group_name, + location=location, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("OperationJobExtendedInfo", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + 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.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_trigger_cross_region_restore.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/locations/{location}/crossRegionRestore" + } + + async def _validate_cross_region_restore_initial( + self, + resource_group_name: str, + location: str, + parameters: Union[_models.ValidateCrossRegionRestoreRequestObject, IO], + **kwargs: Any + ) -> Optional[_models.OperationJobExtendedInfo]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ValidateCrossRegionRestoreRequestObject") + + request = build_validate_cross_region_restore_request( + resource_group_name=resource_group_name, + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._validate_cross_region_restore_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + 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 [200, 202]: + 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( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _validate_cross_region_restore_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/locations/{location}/validateCrossRegionRestore" + } + + @overload + async def begin_validate_cross_region_restore( + self, + resource_group_name: str, + location: str, + parameters: _models.ValidateCrossRegionRestoreRequestObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: + """validate_cross_region_restore. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: Required. + :type location: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.ValidateCrossRegionRestoreRequestObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationJobExtendedInfo or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_validate_cross_region_restore( + self, + resource_group_name: str, + location: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: + """validate_cross_region_restore. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: Required. + :type location: str + :param parameters: Request body for operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationJobExtendedInfo or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_validate_cross_region_restore( + self, + resource_group_name: str, + location: str, + parameters: Union[_models.ValidateCrossRegionRestoreRequestObject, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: + """validate_cross_region_restore. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: Required. + :type location: str + :param parameters: Request body for operation. Is either a + ValidateCrossRegionRestoreRequestObject type or a IO type. Required. + :type parameters: ~azure.mgmt.dataprotection.models.ValidateCrossRegionRestoreRequestObject or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationJobExtendedInfo or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :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[_models.OperationJobExtendedInfo] = 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_cross_region_restore_initial( + resource_group_name=resource_group_name, + location=location, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("OperationJobExtendedInfo", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + 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.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_validate_cross_region_restore.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/locations/{location}/validateCrossRegionRestore" + } + async def _trigger_rehydrate_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, @@ -1195,9 +1650,7 @@ async def _trigger_rehydrate_initial( # pylint: disable=inconsistent-return-sta _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -1225,8 +1678,9 @@ async def _trigger_rehydrate_initial( # pylint: disable=inconsistent-return-sta request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1365,9 +1819,7 @@ async def begin_trigger_rehydrate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -1430,9 +1882,7 @@ async def _trigger_restore_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -1460,8 +1910,9 @@ async def _trigger_restore_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1612,9 +2063,7 @@ async def begin_trigger_restore( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.OperationJobExtendedInfo] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -1674,9 +2123,7 @@ async def _resume_backups_initial( # pylint: disable=inconsistent-return-statem _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_resume_backups_request( @@ -1692,8 +2139,9 @@ async def _resume_backups_initial( # pylint: disable=inconsistent-return-statem request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1745,9 +2193,7 @@ async def begin_resume_backups( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) 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) @@ -1802,9 +2248,7 @@ async def _resume_protection_initial( # pylint: disable=inconsistent-return-sta _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_resume_protection_request( @@ -1820,8 +2264,9 @@ async def _resume_protection_initial( # pylint: disable=inconsistent-return-sta request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1873,9 +2318,7 @@ async def begin_resume_protection( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) 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) @@ -1930,9 +2373,7 @@ async def _stop_protection_initial( # pylint: disable=inconsistent-return-state _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_stop_protection_request( @@ -1948,8 +2389,9 @@ async def _stop_protection_initial( # pylint: disable=inconsistent-return-state request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2001,9 +2443,7 @@ async def begin_stop_protection( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) 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) @@ -2058,9 +2498,7 @@ async def _suspend_backups_initial( # pylint: disable=inconsistent-return-state _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_suspend_backups_request( @@ -2076,8 +2514,9 @@ async def _suspend_backups_initial( # pylint: disable=inconsistent-return-state request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2130,9 +2569,7 @@ async def begin_suspend_backups( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) 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) @@ -2192,9 +2629,7 @@ async def _sync_backup_instance_initial( # pylint: disable=inconsistent-return- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -2222,8 +2657,9 @@ async def _sync_backup_instance_initial( # pylint: disable=inconsistent-return- request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2365,9 +2801,7 @@ async def begin_sync_backup_instance( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -2430,9 +2864,7 @@ async def _validate_for_restore_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -2460,8 +2892,9 @@ async def _validate_for_restore_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2612,9 +3045,7 @@ async def begin_validate_for_restore( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.OperationJobExtendedInfo] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) 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 bed5e2b76031..70e4cd3ddf6e 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -36,10 +35,6 @@ build_list_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -84,9 +79,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -140,8 +133,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -188,9 +182,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BaseBackupPolicyResource] = kwargs.pop("cls", None) request = build_get_request( @@ -206,8 +198,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -335,9 +328,7 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.BaseBackupPolicyResource] = kwargs.pop("cls", None) @@ -365,8 +356,9 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -417,9 +409,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -435,8 +425,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 777308fa8277..45fc64bfb1ac 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from ..._vendor import _convert_request from ...operations._backup_vault_operation_results_operations import build_get_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -84,9 +79,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Optional[_models.BackupVaultResource]] = kwargs.pop("cls", None) request = build_get_request( @@ -102,8 +95,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 157173670396..7fbf85b44c74 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -41,10 +40,6 @@ build_update_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -81,9 +76,7 @@ def get_in_subscription(self, **kwargs: Any) -> AsyncIterable["_models.BackupVau _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -135,8 +128,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -170,9 +164,7 @@ def get_in_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -225,8 +217,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -267,9 +260,7 @@ async def get(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BackupVaultResource] = kwargs.pop("cls", None) request = build_get_request( @@ -284,8 +275,9 @@ async def get(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -323,9 +315,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -352,8 +342,9 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -489,9 +480,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -550,9 +539,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -567,8 +554,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -608,9 +596,7 @@ async def begin_delete(self, resource_group_name: str, vault_name: str, **kwargs _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) 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) @@ -668,9 +654,7 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -697,8 +681,9 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -835,9 +820,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -981,9 +964,7 @@ async def check_name_availability( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.CheckNameAvailabilityResult] = kwargs.pop("cls", None) @@ -1010,8 +991,9 @@ async def check_name_availability( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_cross_region_restore_job_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_cross_region_restore_job_operations.py new file mode 100644 index 000000000000..2bb7685f0dc8 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_cross_region_restore_job_operations.py @@ -0,0 +1,193 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import 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._cross_region_restore_job_operations import build_get_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class CrossRegionRestoreJobOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.dataprotection.aio.DataProtectionMgmtClient`'s + :attr:`cross_region_restore_job` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + async def get( + self, + resource_group_name: str, + location: str, + parameters: _models.CrossRegionRestoreJobRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AzureBackupJobResource: + """get. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: Required. + :type location: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.CrossRegionRestoreJobRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AzureBackupJobResource or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.AzureBackupJobResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def get( + self, + resource_group_name: str, + location: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AzureBackupJobResource: + """get. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: Required. + :type location: str + :param parameters: Request body for operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AzureBackupJobResource or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.AzureBackupJobResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + location: str, + parameters: Union[_models.CrossRegionRestoreJobRequest, IO], + **kwargs: Any + ) -> _models.AzureBackupJobResource: + """get. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: Required. + :type location: str + :param parameters: Request body for operation. Is either a CrossRegionRestoreJobRequest type or + a IO type. Required. + :type parameters: ~azure.mgmt.dataprotection.models.CrossRegionRestoreJobRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AzureBackupJobResource or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.AzureBackupJobResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.AzureBackupJobResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CrossRegionRestoreJobRequest") + + request = build_get_request( + resource_group_name=resource_group_name, + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + 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 [200]: + 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) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/locations/{location}/fetchCrossRegionRestoreJob" + } diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_cross_region_restore_jobs_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_cross_region_restore_jobs_operations.py new file mode 100644 index 000000000000..0bccc0ef57a9 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_cross_region_restore_jobs_operations.py @@ -0,0 +1,227 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._cross_region_restore_jobs_operations import build_list_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class CrossRegionRestoreJobsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.dataprotection.aio.DataProtectionMgmtClient`'s + :attr:`cross_region_restore_jobs` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + def list( + self, + resource_group_name: str, + location: str, + parameters: _models.CrossRegionRestoreJobsRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterable["_models.AzureBackupJobResource"]: + """list. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: Required. + :type location: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.CrossRegionRestoreJobsRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AzureBackupJobResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.AzureBackupJobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def list( + self, + resource_group_name: str, + location: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterable["_models.AzureBackupJobResource"]: + """list. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: Required. + :type location: str + :param parameters: Request body for operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AzureBackupJobResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.AzureBackupJobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def list( + self, + resource_group_name: str, + location: str, + parameters: Union[_models.CrossRegionRestoreJobsRequest, IO], + **kwargs: Any + ) -> AsyncIterable["_models.AzureBackupJobResource"]: + """list. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: Required. + :type location: str + :param parameters: Request body for operation. Is either a CrossRegionRestoreJobsRequest type + or a IO type. Required. + :type parameters: ~azure.mgmt.dataprotection.models.CrossRegionRestoreJobsRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AzureBackupJobResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.AzureBackupJobResource] + :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[_models.AzureBackupJobResourceList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CrossRegionRestoreJobsRequest") + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + 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 + + async def extract_data(pipeline_response): + deserialized = self._deserialize("AzureBackupJobResourceList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + 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 [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/locations/{location}/fetchCrossRegionRestoreJobs" + } 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 2585b302f9bf..72cd1e1f6483 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from ..._vendor import _convert_request from ...operations._data_protection_operations import build_check_feature_support_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -134,9 +129,7 @@ async def check_feature_support( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.FeatureValidationResponseBase] = kwargs.pop("cls", None) @@ -162,8 +155,9 @@ async def check_feature_support( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 bec2f2a40495..345e0d4d1f75 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._data_protection_operations_operations import build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,9 +66,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ClientDiscoveryValueForS _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -124,8 +117,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 8a40199d93c5..1cc65d1f39c8 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast import urllib.parse @@ -37,10 +36,6 @@ build_undelete_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -85,9 +80,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -141,8 +134,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -187,9 +181,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DeletedBackupInstanceResource] = kwargs.pop("cls", None) request = build_get_request( @@ -205,8 +197,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -240,9 +233,7 @@ async def _undelete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_undelete_request( @@ -258,8 +249,9 @@ async def _undelete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -303,9 +295,7 @@ async def begin_undelete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) 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) 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 new file mode 100644 index 000000000000..531256cd7f48 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_dpp_resource_guard_proxy_operations.py @@ -0,0 +1,607 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._dpp_resource_guard_proxy_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, + build_unlock_delete_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class DppResourceGuardProxyOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.dataprotection.aio.DataProtectionMgmtClient`'s + :attr:`dpp_resource_guard_proxy` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, vault_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ResourceGuardProxyBaseResource"]: + """Returns the list of ResourceGuardProxies associated with the vault. + + Returns the list of ResourceGuardProxies associated with the vault. + + :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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceGuardProxyBaseResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = 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)) + cls: ClsType[_models.ResourceGuardProxyBaseResourceList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + 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 + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ResourceGuardProxyBaseResourceList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + 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 [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, vault_name: str, resource_guard_proxy_name: str, **kwargs: Any + ) -> _models.ResourceGuardProxyBaseResource: + """Returns the ResourceGuardProxy object associated with the vault, and that matches the name in + the request. + + Returns the ResourceGuardProxy object associated with the vault, and that matches the name in + the request. + + :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 resource_guard_proxy_name: name of the resource guard proxy. Required. + :type resource_guard_proxy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceGuardProxyBaseResource or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = 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)) + cls: ClsType[_models.ResourceGuardProxyBaseResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + resource_guard_proxy_name=resource_guard_proxy_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + 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 [200]: + 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) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + vault_name: str, + resource_guard_proxy_name: str, + parameters: _models.ResourceGuardProxyBaseResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ResourceGuardProxyBaseResource: + """Creates or Updates a ResourceGuardProxy. + + Creates or Updates a ResourceGuardProxy. + + :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 resource_guard_proxy_name: name of the resource guard proxy. Required. + :type resource_guard_proxy_name: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceGuardProxyBaseResource or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + vault_name: str, + resource_guard_proxy_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ResourceGuardProxyBaseResource: + """Creates or Updates a ResourceGuardProxy. + + Creates or Updates a ResourceGuardProxy. + + :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 resource_guard_proxy_name: name of the resource guard proxy. Required. + :type resource_guard_proxy_name: str + :param parameters: Request body for operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceGuardProxyBaseResource or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + vault_name: str, + resource_guard_proxy_name: str, + parameters: Union[_models.ResourceGuardProxyBaseResource, IO], + **kwargs: Any + ) -> _models.ResourceGuardProxyBaseResource: + """Creates or Updates a ResourceGuardProxy. + + Creates or Updates a ResourceGuardProxy. + + :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 resource_guard_proxy_name: name of the resource guard proxy. Required. + :type resource_guard_proxy_name: str + :param parameters: Request body for operation. Is either a ResourceGuardProxyBaseResource type + or a IO type. Required. + :type parameters: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceGuardProxyBaseResource or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.ResourceGuardProxyBaseResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ResourceGuardProxyBaseResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + resource_guard_proxy_name=resource_guard_proxy_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + 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 [200]: + 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) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, vault_name: str, resource_guard_proxy_name: str, **kwargs: Any + ) -> None: + """Deletes the ResourceGuardProxy. + + Deletes the ResourceGuardProxy. + + :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 resource_guard_proxy_name: name of the resource guard proxy. Required. + :type resource_guard_proxy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = 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)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + resource_guard_proxy_name=resource_guard_proxy_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + 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 [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}" + } + + @overload + async def unlock_delete( + self, + resource_group_name: str, + vault_name: str, + resource_guard_proxy_name: str, + parameters: _models.UnlockDeleteRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.UnlockDeleteResponse: + """UnlockDelete call for ResourceGuardProxy, executed before one can delete it. + + UnlockDelete call for ResourceGuardProxy, executed before one can delete it. + + :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 resource_guard_proxy_name: name of the resource guard proxy. Required. + :type resource_guard_proxy_name: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.UnlockDeleteRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: UnlockDeleteResponse or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.UnlockDeleteResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def unlock_delete( + self, + resource_group_name: str, + vault_name: str, + resource_guard_proxy_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.UnlockDeleteResponse: + """UnlockDelete call for ResourceGuardProxy, executed before one can delete it. + + UnlockDelete call for ResourceGuardProxy, executed before one can delete it. + + :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 resource_guard_proxy_name: name of the resource guard proxy. Required. + :type resource_guard_proxy_name: str + :param parameters: Request body for operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: UnlockDeleteResponse or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.UnlockDeleteResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def unlock_delete( + self, + resource_group_name: str, + vault_name: str, + resource_guard_proxy_name: str, + parameters: Union[_models.UnlockDeleteRequest, IO], + **kwargs: Any + ) -> _models.UnlockDeleteResponse: + """UnlockDelete call for ResourceGuardProxy, executed before one can delete it. + + UnlockDelete call for ResourceGuardProxy, executed before one can delete it. + + :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 resource_guard_proxy_name: name of the resource guard proxy. Required. + :type resource_guard_proxy_name: str + :param parameters: Request body for operation. Is either a UnlockDeleteRequest type or a IO + type. Required. + :type parameters: ~azure.mgmt.dataprotection.models.UnlockDeleteRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: UnlockDeleteResponse or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.UnlockDeleteResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.UnlockDeleteResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "UnlockDeleteRequest") + + request = build_unlock_delete_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + resource_guard_proxy_name=resource_guard_proxy_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.unlock_delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + 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 [200]: + 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) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + unlock_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}/unlockDelete" + } 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 357aef650008..ebe41aa48e6b 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from ..._vendor import _convert_request from ...operations._export_jobs_operation_result_operations import build_get_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -86,9 +81,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Optional[_models.ExportJobsResult]] = kwargs.pop("cls", None) request = build_get_request( @@ -104,8 +97,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 cea189a02943..014d94bbc1d4 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.exceptions import ( @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._export_jobs_operations import build_trigger_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,9 +66,7 @@ async def _trigger_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_trigger_request( @@ -88,8 +81,9 @@ async def _trigger_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -134,9 +128,7 @@ async def begin_trigger(self, resource_group_name: str, vault_name: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) 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) 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 4ad45fe60b57..2a959e7644e1 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -31,10 +30,6 @@ from ..._vendor import _convert_request from ...operations._jobs_operations import build_get_request, build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -79,9 +74,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -135,8 +128,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -182,9 +176,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AzureBackupJobResource] = kwargs.pop("cls", None) request = build_get_request( @@ -200,8 +192,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 6ee4c3d2c46f..ca45f75b3e43 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from ..._vendor import _convert_request from ...operations._operation_result_operations import build_get_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -81,9 +76,7 @@ async def get(self, operation_id: str, location: str, **kwargs: Any) -> Optional _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Optional[_models.OperationJobExtendedInfo]] = kwargs.pop("cls", None) request = build_get_request( @@ -98,8 +91,9 @@ async def get(self, operation_id: str, location: str, **kwargs: Any) -> Optional request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 2021abed1c32..b63ed87f7efd 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from ..._vendor import _convert_request from ...operations._operation_status_backup_vault_context_operations import build_get_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -86,9 +81,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationResource] = kwargs.pop("cls", None) request = build_get_request( @@ -104,8 +97,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 e6fd595bb966..1f2a9ff2d137 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from ..._vendor import _convert_request from ...operations._operation_status_operations import build_get_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -81,9 +76,7 @@ async def get(self, location: str, operation_id: str, **kwargs: Any) -> _models. _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationResource] = kwargs.pop("cls", None) request = build_get_request( @@ -98,8 +91,9 @@ async def get(self, location: str, operation_id: str, **kwargs: Any) -> _models. request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 35fee05cd48b..c88e1e728c2e 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from ..._vendor import _convert_request from ...operations._operation_status_resource_group_context_operations import build_get_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -82,9 +77,7 @@ async def get(self, resource_group_name: str, operation_id: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationResource] = kwargs.pop("cls", None) request = build_get_request( @@ -99,8 +92,9 @@ async def get(self, resource_group_name: str, operation_id: str, **kwargs: Any) request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 fd451be378c5..3b50b18e7750 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -31,10 +30,6 @@ from ..._vendor import _convert_request from ...operations._recovery_points_operations import build_get_request, build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -91,9 +86,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -150,8 +143,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -203,9 +197,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AzureBackupRecoveryPointResource] = kwargs.pop("cls", None) request = build_get_request( @@ -222,8 +214,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 984a8a9f6957..38ca417045c0 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -50,10 +49,6 @@ build_put_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -93,9 +88,7 @@ def get_resources_in_subscription(self, **kwargs: Any) -> AsyncIterable["_models _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -147,8 +140,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -185,9 +179,7 @@ def get_resources_in_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -240,8 +232,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -356,9 +349,7 @@ async def put( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.ResourceGuardResource] = kwargs.pop("cls", None) @@ -385,8 +376,9 @@ async def put( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -439,9 +431,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ResourceGuardResource] = kwargs.pop("cls", None) request = build_get_request( @@ -456,8 +446,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -506,9 +497,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -523,8 +512,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -645,9 +635,7 @@ async def patch( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.ResourceGuardResource] = kwargs.pop("cls", None) @@ -674,8 +662,9 @@ async def patch( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -719,9 +708,7 @@ def get_disable_soft_delete_requests_objects( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -775,8 +762,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -793,7 +781,7 @@ async def get_next(next_link=None): } @distributed_trace - def get_delete_resource_guard_proxy_requests_objects( + def get_delete_resource_guard_proxy_requests_objects( # pylint: disable=name-too-long self, resource_group_name: str, resource_guards_name: str, **kwargs: Any ) -> AsyncIterable["_models.DppBaseResource"]: """Returns collection of operation request objects for a critical operation protected by the given @@ -816,9 +804,7 @@ def get_delete_resource_guard_proxy_requests_objects( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -872,8 +858,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -913,9 +900,7 @@ def get_backup_security_pin_requests_objects( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -969,8 +954,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -987,7 +973,7 @@ async def get_next(next_link=None): } @distributed_trace - def get_delete_protected_item_requests_objects( + def get_delete_protected_item_requests_objects( # pylint: disable=name-too-long self, resource_group_name: str, resource_guards_name: str, **kwargs: Any ) -> AsyncIterable["_models.DppBaseResource"]: """Returns collection of operation request objects for a critical operation protected by the given @@ -1010,9 +996,7 @@ def get_delete_protected_item_requests_objects( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -1066,8 +1050,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1084,7 +1069,7 @@ async def get_next(next_link=None): } @distributed_trace - def get_update_protection_policy_requests_objects( + def get_update_protection_policy_requests_objects( # pylint: disable=name-too-long self, resource_group_name: str, resource_guards_name: str, **kwargs: Any ) -> AsyncIterable["_models.DppBaseResource"]: """Returns collection of operation request objects for a critical operation protected by the given @@ -1107,9 +1092,7 @@ def get_update_protection_policy_requests_objects( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -1163,8 +1146,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1181,7 +1165,7 @@ async def get_next(next_link=None): } @distributed_trace - def get_update_protected_item_requests_objects( + def get_update_protected_item_requests_objects( # pylint: disable=name-too-long self, resource_group_name: str, resource_guards_name: str, **kwargs: Any ) -> AsyncIterable["_models.DppBaseResource"]: """Returns collection of operation request objects for a critical operation protected by the given @@ -1204,9 +1188,7 @@ def get_update_protected_item_requests_objects( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -1260,8 +1242,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1278,7 +1261,7 @@ async def get_next(next_link=None): } @distributed_trace_async - async def get_default_disable_soft_delete_requests_object( + async def get_default_disable_soft_delete_requests_object( # pylint: disable=name-too-long self, resource_group_name: str, resource_guards_name: str, request_name: str, **kwargs: Any ) -> _models.DppBaseResource: """Returns collection of operation request objects for a critical operation protected by the given @@ -1310,9 +1293,7 @@ async def get_default_disable_soft_delete_requests_object( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) request = build_get_default_disable_soft_delete_requests_object_request( @@ -1328,8 +1309,9 @@ async def get_default_disable_soft_delete_requests_object( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1350,7 +1332,7 @@ async def get_default_disable_soft_delete_requests_object( } @distributed_trace_async - async def get_default_delete_resource_guard_proxy_requests_object( + async def get_default_delete_resource_guard_proxy_requests_object( # pylint: disable=name-too-long self, resource_group_name: str, resource_guards_name: str, request_name: str, **kwargs: Any ) -> _models.DppBaseResource: """Returns collection of operation request objects for a critical operation protected by the given @@ -1382,9 +1364,7 @@ async def get_default_delete_resource_guard_proxy_requests_object( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) request = build_get_default_delete_resource_guard_proxy_requests_object_request( @@ -1400,8 +1380,9 @@ async def get_default_delete_resource_guard_proxy_requests_object( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1422,7 +1403,7 @@ async def get_default_delete_resource_guard_proxy_requests_object( } @distributed_trace_async - async def get_default_backup_security_pin_requests_object( + async def get_default_backup_security_pin_requests_object( # pylint: disable=name-too-long self, resource_group_name: str, resource_guards_name: str, request_name: str, **kwargs: Any ) -> _models.DppBaseResource: """Returns collection of operation request objects for a critical operation protected by the given @@ -1454,9 +1435,7 @@ async def get_default_backup_security_pin_requests_object( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) request = build_get_default_backup_security_pin_requests_object_request( @@ -1472,8 +1451,9 @@ async def get_default_backup_security_pin_requests_object( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1494,7 +1474,7 @@ async def get_default_backup_security_pin_requests_object( } @distributed_trace_async - async def get_default_delete_protected_item_requests_object( + async def get_default_delete_protected_item_requests_object( # pylint: disable=name-too-long self, resource_group_name: str, resource_guards_name: str, request_name: str, **kwargs: Any ) -> _models.DppBaseResource: """Returns collection of operation request objects for a critical operation protected by the given @@ -1526,9 +1506,7 @@ async def get_default_delete_protected_item_requests_object( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) request = build_get_default_delete_protected_item_requests_object_request( @@ -1544,8 +1522,9 @@ async def get_default_delete_protected_item_requests_object( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1566,7 +1545,7 @@ async def get_default_delete_protected_item_requests_object( } @distributed_trace_async - async def get_default_update_protection_policy_requests_object( + async def get_default_update_protection_policy_requests_object( # pylint: disable=name-too-long self, resource_group_name: str, resource_guards_name: str, request_name: str, **kwargs: Any ) -> _models.DppBaseResource: """Returns collection of operation request objects for a critical operation protected by the given @@ -1598,9 +1577,7 @@ async def get_default_update_protection_policy_requests_object( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) request = build_get_default_update_protection_policy_requests_object_request( @@ -1616,8 +1593,9 @@ async def get_default_update_protection_policy_requests_object( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1638,7 +1616,7 @@ async def get_default_update_protection_policy_requests_object( } @distributed_trace_async - async def get_default_update_protected_item_requests_object( + async def get_default_update_protected_item_requests_object( # pylint: disable=name-too-long self, resource_group_name: str, resource_guards_name: str, request_name: str, **kwargs: Any ) -> _models.DppBaseResource: """Returns collection of operation request objects for a critical operation protected by the given @@ -1670,9 +1648,7 @@ async def get_default_update_protected_item_requests_object( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) request = build_get_default_update_protected_item_requests_object_request( @@ -1688,8 +1664,9 @@ async def get_default_update_protected_item_requests_object( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 f9eafa86c2d3..79a6065e3fc5 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from ..._vendor import _convert_request from ...operations._restorable_time_ranges_operations import build_find_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -158,9 +153,7 @@ async def find( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.AzureBackupFindRestorableTimeRangesResponseResource] = kwargs.pop("cls", None) @@ -188,8 +181,9 @@ async def find( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_secondary_rps_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_secondary_rps_operations.py new file mode 100644 index 000000000000..b24d8a3565ab --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_secondary_rps_operations.py @@ -0,0 +1,250 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._secondary_rps_operations import build_fetch_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class SecondaryRPsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.dataprotection.aio.DataProtectionMgmtClient`'s + :attr:`secondary_rps` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + def fetch( + self, + resource_group_name: str, + location: str, + parameters: _models.FetchSecondaryRPsRequestParameters, + filter: Optional[str] = None, + skip_token: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterable["_models.AzureBackupRecoveryPointResource"]: + """Returns a list of Secondary Recovery Points for a DataSource in a vault, that can be used for + Cross Region Restore. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: Required. + :type location: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.FetchSecondaryRPsRequestParameters + :param filter: OData filter options. Default value is None. + :type filter: str + :param skip_token: skipToken Filter. Default value is None. + :type skip_token: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AzureBackupRecoveryPointResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.AzureBackupRecoveryPointResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def fetch( + self, + resource_group_name: str, + location: str, + parameters: IO, + filter: Optional[str] = None, + skip_token: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterable["_models.AzureBackupRecoveryPointResource"]: + """Returns a list of Secondary Recovery Points for a DataSource in a vault, that can be used for + Cross Region Restore. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: Required. + :type location: str + :param parameters: Request body for operation. Required. + :type parameters: IO + :param filter: OData filter options. Default value is None. + :type filter: str + :param skip_token: skipToken Filter. Default value is None. + :type skip_token: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AzureBackupRecoveryPointResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.AzureBackupRecoveryPointResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def fetch( + self, + resource_group_name: str, + location: str, + parameters: Union[_models.FetchSecondaryRPsRequestParameters, IO], + filter: Optional[str] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.AzureBackupRecoveryPointResource"]: + """Returns a list of Secondary Recovery Points for a DataSource in a vault, that can be used for + Cross Region Restore. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: Required. + :type location: str + :param parameters: Request body for operation. Is either a FetchSecondaryRPsRequestParameters + type or a IO type. Required. + :type parameters: ~azure.mgmt.dataprotection.models.FetchSecondaryRPsRequestParameters or IO + :param filter: OData filter options. Default value is None. + :type filter: str + :param skip_token: skipToken Filter. Default value is None. + :type skip_token: str + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AzureBackupRecoveryPointResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.AzureBackupRecoveryPointResource] + :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[_models.AzureBackupRecoveryPointResourceList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "FetchSecondaryRPsRequestParameters") + + def prepare_request(next_link=None): + if not next_link: + + request = build_fetch_request( + resource_group_name=resource_group_name, + location=location, + subscription_id=self._config.subscription_id, + filter=filter, + skip_token=skip_token, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.fetch.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + 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 + + async def extract_data(pipeline_response): + deserialized = self._deserialize("AzureBackupRecoveryPointResourceList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + 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 [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + fetch.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/locations/{location}/fetchSecondaryRecoveryPoints" + } 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 68927a1a9dad..0beeefe1d896 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 @@ -59,6 +59,11 @@ from ._models_py3 import ClientDiscoveryValueForSingleApi 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 @@ -89,6 +94,8 @@ 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 @@ -116,6 +123,10 @@ 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 @@ -141,13 +152,18 @@ 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 UserAssignedIdentityDetails from ._models_py3 import UserFacingError +from ._models_py3 import ValidateCrossRegionRestoreRequestObject from ._models_py3 import ValidateForBackupRequest from ._models_py3 import ValidateRestoreRequestObject from ._data_protection_mgmt_client_enums import AbsoluteMarker from ._data_protection_mgmt_client_enums import AlertsState 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 @@ -166,6 +182,7 @@ 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 @@ -232,6 +249,11 @@ "ClientDiscoveryValueForSingleApi", "CopyOnExpiryOption", "CopyOption", + "CrossRegionRestoreDetails", + "CrossRegionRestoreJobRequest", + "CrossRegionRestoreJobsRequest", + "CrossRegionRestoreRequestObject", + "CrossRegionRestoreSettings", "CrossSubscriptionRestoreSettings", "CustomCopyOption", "DataStoreInfoBase", @@ -262,6 +284,8 @@ "FeatureValidationRequestBase", "FeatureValidationResponse", "FeatureValidationResponseBase", + "FetchSecondaryRPsRequestParameters", + "IdentityDetails", "ImmediateCopyOption", "ImmutabilitySettings", "InnerError", @@ -289,6 +313,10 @@ "RecoveryPointsFilters", "ResourceGuard", "ResourceGuardOperation", + "ResourceGuardOperationDetail", + "ResourceGuardProxyBase", + "ResourceGuardProxyBaseResource", + "ResourceGuardProxyBaseResourceList", "ResourceGuardResource", "ResourceGuardResourceList", "ResourceMoveDetails", @@ -314,12 +342,17 @@ "TargetDetails", "TriggerBackupRequest", "TriggerContext", + "UnlockDeleteRequest", + "UnlockDeleteResponse", + "UserAssignedIdentityDetails", "UserFacingError", + "ValidateCrossRegionRestoreRequestObject", "ValidateForBackupRequest", "ValidateRestoreRequestObject", "AbsoluteMarker", "AlertsState", "CreatedByType", + "CrossRegionRestoreState", "CrossSubscriptionRestoreState", "CurrentProtectionState", "DataStoreTypes", @@ -338,6 +371,7 @@ "RestoreSourceDataStoreType", "RestoreTargetLocationType", "SecretStoreType", + "SecureScoreLevel", "SoftDeleteState", "SourceDataStoreType", "Status", 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 ab1e7729a408..8f1299ab71ea 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 @@ -36,6 +36,13 @@ class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): KEY = "Key" +class CrossRegionRestoreState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """CrossRegionRestore state.""" + + DISABLED = "Disabled" + ENABLED = "Enabled" + + class CrossSubscriptionRestoreState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """CrossSubscriptionRestore state.""" @@ -217,6 +224,16 @@ class SecretStoreType(str, Enum, metaclass=CaseInsensitiveEnumMeta): AZURE_KEY_VAULT = "AzureKeyVault" +class SecureScoreLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Secure Score of Backup Vault.""" + + NONE = "None" + MINIMUM = "Minimum" + ADEQUATE = "Adequate" + MAXIMUM = "Maximum" + NOT_SUPPORTED = "NotSupported" + + class SoftDeleteState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """State of soft delete.""" 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 adddde516415..380614afbea3 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 @@ -1114,6 +1114,9 @@ class AzureBackupRestoreRequest(_serialization.Model): :ivar source_resource_id: Fully qualified Azure Resource Manager ID of the datasource which is being recovered. :vartype source_resource_id: str + :ivar identity_details: Contains information of the Identity Details for the BI. + If it is null, default will be considered as System Assigned. + :vartype identity_details: ~azure.mgmt.dataprotection.models.IdentityDetails """ _validation = { @@ -1127,6 +1130,7 @@ class AzureBackupRestoreRequest(_serialization.Model): "restore_target_info": {"key": "restoreTargetInfo", "type": "RestoreTargetInfoBase"}, "source_data_store_type": {"key": "sourceDataStoreType", "type": "str"}, "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "identity_details": {"key": "identityDetails", "type": "IdentityDetails"}, } _subtype_map = { @@ -1142,6 +1146,7 @@ def __init__( restore_target_info: "_models.RestoreTargetInfoBase", source_data_store_type: Union[str, "_models.SourceDataStoreType"], source_resource_id: Optional[str] = None, + identity_details: Optional["_models.IdentityDetails"] = None, **kwargs: Any ) -> None: """ @@ -1153,12 +1158,16 @@ def __init__( :keyword source_resource_id: Fully qualified Azure Resource Manager ID of the datasource which is being recovered. :paramtype source_resource_id: str + :keyword identity_details: Contains information of the Identity Details for the BI. + If it is null, default will be considered as System Assigned. + :paramtype identity_details: ~azure.mgmt.dataprotection.models.IdentityDetails """ super().__init__(**kwargs) self.object_type: Optional[str] = None self.restore_target_info = restore_target_info self.source_data_store_type = source_data_store_type self.source_resource_id = source_resource_id + self.identity_details = identity_details class AzureBackupRecoveryPointBasedRestoreRequest(AzureBackupRestoreRequest): @@ -1179,6 +1188,9 @@ class AzureBackupRecoveryPointBasedRestoreRequest(AzureBackupRestoreRequest): :ivar source_resource_id: Fully qualified Azure Resource Manager ID of the datasource which is being recovered. :vartype source_resource_id: str + :ivar identity_details: Contains information of the Identity Details for the BI. + If it is null, default will be considered as System Assigned. + :vartype identity_details: ~azure.mgmt.dataprotection.models.IdentityDetails :ivar recovery_point_id: Required. :vartype recovery_point_id: str """ @@ -1195,6 +1207,7 @@ class AzureBackupRecoveryPointBasedRestoreRequest(AzureBackupRestoreRequest): "restore_target_info": {"key": "restoreTargetInfo", "type": "RestoreTargetInfoBase"}, "source_data_store_type": {"key": "sourceDataStoreType", "type": "str"}, "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "identity_details": {"key": "identityDetails", "type": "IdentityDetails"}, "recovery_point_id": {"key": "recoveryPointId", "type": "str"}, } @@ -1209,6 +1222,7 @@ def __init__( source_data_store_type: Union[str, "_models.SourceDataStoreType"], recovery_point_id: str, source_resource_id: Optional[str] = None, + identity_details: Optional["_models.IdentityDetails"] = None, **kwargs: Any ) -> None: """ @@ -1220,6 +1234,9 @@ def __init__( :keyword source_resource_id: Fully qualified Azure Resource Manager ID of the datasource which is being recovered. :paramtype source_resource_id: str + :keyword identity_details: Contains information of the Identity Details for the BI. + If it is null, default will be considered as System Assigned. + :paramtype identity_details: ~azure.mgmt.dataprotection.models.IdentityDetails :keyword recovery_point_id: Required. :paramtype recovery_point_id: str """ @@ -1227,6 +1244,7 @@ def __init__( restore_target_info=restore_target_info, source_data_store_type=source_data_store_type, source_resource_id=source_resource_id, + identity_details=identity_details, **kwargs ) self.object_type: str = "AzureBackupRecoveryPointBasedRestoreRequest" @@ -1323,6 +1341,9 @@ class AzureBackupRecoveryTimeBasedRestoreRequest(AzureBackupRestoreRequest): :ivar source_resource_id: Fully qualified Azure Resource Manager ID of the datasource which is being recovered. :vartype source_resource_id: str + :ivar identity_details: Contains information of the Identity Details for the BI. + If it is null, default will be considered as System Assigned. + :vartype identity_details: ~azure.mgmt.dataprotection.models.IdentityDetails :ivar recovery_point_time: The recovery time in ISO 8601 format example - 2020-08-14T17:30:00.0000000Z. Required. :vartype recovery_point_time: str @@ -1340,6 +1361,7 @@ class AzureBackupRecoveryTimeBasedRestoreRequest(AzureBackupRestoreRequest): "restore_target_info": {"key": "restoreTargetInfo", "type": "RestoreTargetInfoBase"}, "source_data_store_type": {"key": "sourceDataStoreType", "type": "str"}, "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "identity_details": {"key": "identityDetails", "type": "IdentityDetails"}, "recovery_point_time": {"key": "recoveryPointTime", "type": "str"}, } @@ -1350,6 +1372,7 @@ def __init__( source_data_store_type: Union[str, "_models.SourceDataStoreType"], recovery_point_time: str, source_resource_id: Optional[str] = None, + identity_details: Optional["_models.IdentityDetails"] = None, **kwargs: Any ) -> None: """ @@ -1361,6 +1384,9 @@ def __init__( :keyword source_resource_id: Fully qualified Azure Resource Manager ID of the datasource which is being recovered. :paramtype source_resource_id: str + :keyword identity_details: Contains information of the Identity Details for the BI. + If it is null, default will be considered as System Assigned. + :paramtype identity_details: ~azure.mgmt.dataprotection.models.IdentityDetails :keyword recovery_point_time: The recovery time in ISO 8601 format example - 2020-08-14T17:30:00.0000000Z. Required. :paramtype recovery_point_time: str @@ -1369,6 +1395,7 @@ def __init__( restore_target_info=restore_target_info, source_data_store_type=source_data_store_type, source_resource_id=source_resource_id, + identity_details=identity_details, **kwargs ) self.object_type: str = "AzureBackupRecoveryTimeBasedRestoreRequest" @@ -1440,6 +1467,9 @@ class AzureBackupRestoreWithRehydrationRequest(AzureBackupRecoveryPointBasedRest :ivar source_resource_id: Fully qualified Azure Resource Manager ID of the datasource which is being recovered. :vartype source_resource_id: str + :ivar identity_details: Contains information of the Identity Details for the BI. + If it is null, default will be considered as System Assigned. + :vartype identity_details: ~azure.mgmt.dataprotection.models.IdentityDetails :ivar recovery_point_id: Required. :vartype recovery_point_id: str :ivar rehydration_priority: Priority to be used for rehydration. Values High or Standard. @@ -1464,6 +1494,7 @@ class AzureBackupRestoreWithRehydrationRequest(AzureBackupRecoveryPointBasedRest "restore_target_info": {"key": "restoreTargetInfo", "type": "RestoreTargetInfoBase"}, "source_data_store_type": {"key": "sourceDataStoreType", "type": "str"}, "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "identity_details": {"key": "identityDetails", "type": "IdentityDetails"}, "recovery_point_id": {"key": "recoveryPointId", "type": "str"}, "rehydration_priority": {"key": "rehydrationPriority", "type": "str"}, "rehydration_retention_duration": {"key": "rehydrationRetentionDuration", "type": "str"}, @@ -1478,6 +1509,7 @@ def __init__( rehydration_priority: Union[str, "_models.RehydrationPriority"], rehydration_retention_duration: str, source_resource_id: Optional[str] = None, + identity_details: Optional["_models.IdentityDetails"] = None, **kwargs: Any ) -> None: """ @@ -1489,6 +1521,9 @@ def __init__( :keyword source_resource_id: Fully qualified Azure Resource Manager ID of the datasource which is being recovered. :paramtype source_resource_id: str + :keyword identity_details: Contains information of the Identity Details for the BI. + If it is null, default will be considered as System Assigned. + :paramtype identity_details: ~azure.mgmt.dataprotection.models.IdentityDetails :keyword recovery_point_id: Required. :paramtype recovery_point_id: str :keyword rehydration_priority: Priority to be used for rehydration. Values High or Standard. @@ -1502,6 +1537,7 @@ def __init__( restore_target_info=restore_target_info, source_data_store_type=source_data_store_type, source_resource_id=source_resource_id, + identity_details=identity_details, recovery_point_id=recovery_point_id, **kwargs ) @@ -1855,6 +1891,9 @@ class BackupInstance(_serialization.Model): # pylint: disable=too-many-instance validations from /validateForBackup API will run again. Known values are: "ShallowValidation" and "DeepValidation". :vartype validation_type: str or ~azure.mgmt.dataprotection.models.ValidationType + :ivar identity_details: Contains information of the Identity Details for the BI. + If it is null, default will be considered as System Assigned. + :vartype identity_details: ~azure.mgmt.dataprotection.models.IdentityDetails :ivar object_type: Required. :vartype object_type: str """ @@ -1880,6 +1919,7 @@ class BackupInstance(_serialization.Model): # pylint: disable=too-many-instance "provisioning_state": {"key": "provisioningState", "type": "str"}, "datasource_auth_credentials": {"key": "datasourceAuthCredentials", "type": "AuthCredentials"}, "validation_type": {"key": "validationType", "type": "str"}, + "identity_details": {"key": "identityDetails", "type": "IdentityDetails"}, "object_type": {"key": "objectType", "type": "str"}, } @@ -1893,6 +1933,7 @@ def __init__( data_source_set_info: Optional["_models.DatasourceSet"] = None, datasource_auth_credentials: Optional["_models.AuthCredentials"] = None, validation_type: Optional[Union[str, "_models.ValidationType"]] = None, + identity_details: Optional["_models.IdentityDetails"] = None, **kwargs: Any ) -> None: """ @@ -1911,6 +1952,9 @@ def __init__( validations from /validateForBackup API will run again. Known values are: "ShallowValidation" and "DeepValidation". :paramtype validation_type: str or ~azure.mgmt.dataprotection.models.ValidationType + :keyword identity_details: Contains information of the Identity Details for the BI. + If it is null, default will be considered as System Assigned. + :paramtype identity_details: ~azure.mgmt.dataprotection.models.IdentityDetails :keyword object_type: Required. :paramtype object_type: str """ @@ -1925,6 +1969,7 @@ def __init__( self.provisioning_state = None self.datasource_auth_credentials = datasource_auth_credentials self.validation_type = validation_type + self.identity_details = identity_details self.object_type = object_type @@ -2195,6 +2240,9 @@ class BackupVault(_serialization.Model): :vartype is_vault_protected_by_resource_guard: bool :ivar feature_settings: Feature Settings. :vartype feature_settings: ~azure.mgmt.dataprotection.models.FeatureSettings + :ivar secure_score: Secure Score of Backup Vault. Known values are: "None", "Minimum", + "Adequate", "Maximum", and "NotSupported". + :vartype secure_score: str or ~azure.mgmt.dataprotection.models.SecureScoreLevel """ _validation = { @@ -2203,6 +2251,7 @@ class BackupVault(_serialization.Model): "resource_move_details": {"readonly": True}, "storage_settings": {"required": True}, "is_vault_protected_by_resource_guard": {"readonly": True}, + "secure_score": {"readonly": True}, } _attribute_map = { @@ -2214,6 +2263,7 @@ class BackupVault(_serialization.Model): "storage_settings": {"key": "storageSettings", "type": "[StorageSetting]"}, "is_vault_protected_by_resource_guard": {"key": "isVaultProtectedByResourceGuard", "type": "bool"}, "feature_settings": {"key": "featureSettings", "type": "FeatureSettings"}, + "secure_score": {"key": "secureScore", "type": "str"}, } def __init__( @@ -2244,6 +2294,7 @@ def __init__( self.storage_settings = storage_settings self.is_vault_protected_by_resource_guard = None self.feature_settings = feature_settings + self.secure_score = None class DppBaseTrackedResource(_serialization.Model): @@ -2933,6 +2984,173 @@ def __init__(self, **kwargs: Any) -> None: self.object_type: str = "CopyOnExpiryOption" +class CrossRegionRestoreDetails(_serialization.Model): + """Cross Region Restore details. + + All required parameters must be populated in order to send to Azure. + + :ivar source_region: Required. + :vartype source_region: str + :ivar source_backup_instance_id: Required. + :vartype source_backup_instance_id: str + """ + + _validation = { + "source_region": {"required": True}, + "source_backup_instance_id": {"required": True}, + } + + _attribute_map = { + "source_region": {"key": "sourceRegion", "type": "str"}, + "source_backup_instance_id": {"key": "sourceBackupInstanceId", "type": "str"}, + } + + def __init__(self, *, source_region: str, source_backup_instance_id: str, **kwargs: Any) -> None: + """ + :keyword source_region: Required. + :paramtype source_region: str + :keyword source_backup_instance_id: Required. + :paramtype source_backup_instance_id: str + """ + super().__init__(**kwargs) + self.source_region = source_region + self.source_backup_instance_id = source_backup_instance_id + + +class CrossRegionRestoreJobRequest(_serialization.Model): + """CrossRegionRestoreJobRequest. + + All required parameters must be populated in order to send to Azure. + + :ivar source_region: Required. + :vartype source_region: str + :ivar source_backup_vault_id: Required. + :vartype source_backup_vault_id: str + :ivar job_id: Required. + :vartype job_id: str + """ + + _validation = { + "source_region": {"required": True}, + "source_backup_vault_id": {"required": True}, + "job_id": {"required": True}, + } + + _attribute_map = { + "source_region": {"key": "sourceRegion", "type": "str"}, + "source_backup_vault_id": {"key": "sourceBackupVaultId", "type": "str"}, + "job_id": {"key": "jobId", "type": "str"}, + } + + def __init__(self, *, source_region: str, source_backup_vault_id: str, job_id: str, **kwargs: Any) -> None: + """ + :keyword source_region: Required. + :paramtype source_region: str + :keyword source_backup_vault_id: Required. + :paramtype source_backup_vault_id: str + :keyword job_id: Required. + :paramtype job_id: str + """ + super().__init__(**kwargs) + self.source_region = source_region + self.source_backup_vault_id = source_backup_vault_id + self.job_id = job_id + + +class CrossRegionRestoreJobsRequest(_serialization.Model): + """CrossRegionRestoreJobsRequest. + + All required parameters must be populated in order to send to Azure. + + :ivar source_region: Required. + :vartype source_region: str + :ivar source_backup_vault_id: Required. + :vartype source_backup_vault_id: str + """ + + _validation = { + "source_region": {"required": True}, + "source_backup_vault_id": {"required": True}, + } + + _attribute_map = { + "source_region": {"key": "sourceRegion", "type": "str"}, + "source_backup_vault_id": {"key": "sourceBackupVaultId", "type": "str"}, + } + + def __init__(self, *, source_region: str, source_backup_vault_id: str, **kwargs: Any) -> None: + """ + :keyword source_region: Required. + :paramtype source_region: str + :keyword source_backup_vault_id: Required. + :paramtype source_backup_vault_id: str + """ + super().__init__(**kwargs) + self.source_region = source_region + self.source_backup_vault_id = source_backup_vault_id + + +class CrossRegionRestoreRequestObject(_serialization.Model): + """Cross Region Restore Request Object. + + All required parameters must be populated in order to send to Azure. + + :ivar restore_request_object: Gets or sets the restore request object. Required. + :vartype restore_request_object: ~azure.mgmt.dataprotection.models.AzureBackupRestoreRequest + :ivar cross_region_restore_details: Cross region restore details. Required. + :vartype cross_region_restore_details: + ~azure.mgmt.dataprotection.models.CrossRegionRestoreDetails + """ + + _validation = { + "restore_request_object": {"required": True}, + "cross_region_restore_details": {"required": True}, + } + + _attribute_map = { + "restore_request_object": {"key": "restoreRequestObject", "type": "AzureBackupRestoreRequest"}, + "cross_region_restore_details": {"key": "crossRegionRestoreDetails", "type": "CrossRegionRestoreDetails"}, + } + + def __init__( + self, + *, + restore_request_object: "_models.AzureBackupRestoreRequest", + cross_region_restore_details: "_models.CrossRegionRestoreDetails", + **kwargs: Any + ) -> None: + """ + :keyword restore_request_object: Gets or sets the restore request object. Required. + :paramtype restore_request_object: ~azure.mgmt.dataprotection.models.AzureBackupRestoreRequest + :keyword cross_region_restore_details: Cross region restore details. Required. + :paramtype cross_region_restore_details: + ~azure.mgmt.dataprotection.models.CrossRegionRestoreDetails + """ + super().__init__(**kwargs) + self.restore_request_object = restore_request_object + self.cross_region_restore_details = cross_region_restore_details + + +class CrossRegionRestoreSettings(_serialization.Model): + """CrossRegionRestoreSettings. + + :ivar state: CrossRegionRestore state. Known values are: "Disabled" and "Enabled". + :vartype state: str or ~azure.mgmt.dataprotection.models.CrossRegionRestoreState + """ + + _attribute_map = { + "state": {"key": "state", "type": "str"}, + } + + def __init__(self, *, state: Optional[Union[str, "_models.CrossRegionRestoreState"]] = None, **kwargs: Any) -> None: + """ + :keyword state: CrossRegionRestore state. Known values are: "Disabled" and "Enabled". + :paramtype state: str or ~azure.mgmt.dataprotection.models.CrossRegionRestoreState + """ + super().__init__(**kwargs) + self.state = state + + class CrossSubscriptionRestoreSettings(_serialization.Model): """CrossSubscriptionRestore Settings. @@ -3238,6 +3456,9 @@ class DeletedBackupInstance(BackupInstance): # pylint: disable=too-many-instanc validations from /validateForBackup API will run again. Known values are: "ShallowValidation" and "DeepValidation". :vartype validation_type: str or ~azure.mgmt.dataprotection.models.ValidationType + :ivar identity_details: Contains information of the Identity Details for the BI. + If it is null, default will be considered as System Assigned. + :vartype identity_details: ~azure.mgmt.dataprotection.models.IdentityDetails :ivar object_type: Required. :vartype object_type: str :ivar deletion_info: Deletion info of Backup Instance. @@ -3266,6 +3487,7 @@ class DeletedBackupInstance(BackupInstance): # pylint: disable=too-many-instanc "provisioning_state": {"key": "provisioningState", "type": "str"}, "datasource_auth_credentials": {"key": "datasourceAuthCredentials", "type": "AuthCredentials"}, "validation_type": {"key": "validationType", "type": "str"}, + "identity_details": {"key": "identityDetails", "type": "IdentityDetails"}, "object_type": {"key": "objectType", "type": "str"}, "deletion_info": {"key": "deletionInfo", "type": "DeletionInfo"}, } @@ -3280,6 +3502,7 @@ def __init__( data_source_set_info: Optional["_models.DatasourceSet"] = None, datasource_auth_credentials: Optional["_models.AuthCredentials"] = None, validation_type: Optional[Union[str, "_models.ValidationType"]] = None, + identity_details: Optional["_models.IdentityDetails"] = None, **kwargs: Any ) -> None: """ @@ -3298,6 +3521,9 @@ def __init__( validations from /validateForBackup API will run again. Known values are: "ShallowValidation" and "DeepValidation". :paramtype validation_type: str or ~azure.mgmt.dataprotection.models.ValidationType + :keyword identity_details: Contains information of the Identity Details for the BI. + If it is null, default will be considered as System Assigned. + :paramtype identity_details: ~azure.mgmt.dataprotection.models.IdentityDetails :keyword object_type: Required. :paramtype object_type: str """ @@ -3308,6 +3534,7 @@ def __init__( policy_info=policy_info, datasource_auth_credentials=datasource_auth_credentials, validation_type=validation_type, + identity_details=identity_details, object_type=object_type, **kwargs ) @@ -3502,8 +3729,12 @@ class DppIdentityDetails(_serialization.Model): :ivar tenant_id: A Globally Unique Identifier (GUID) that represents the Azure AD tenant where the resource is now a member. :vartype tenant_id: str - :ivar type: The identityType which can be either SystemAssigned or None. + :ivar type: The identityType which can be either SystemAssigned, UserAssigned, + 'SystemAssigned,UserAssigned' or None. :vartype type: str + :ivar user_assigned_identities: Gets or sets the user assigned identities. + :vartype user_assigned_identities: dict[str, + ~azure.mgmt.dataprotection.models.UserAssignedIdentityDetails] """ _validation = { @@ -3515,17 +3746,29 @@ class DppIdentityDetails(_serialization.Model): "principal_id": {"key": "principalId", "type": "str"}, "tenant_id": {"key": "tenantId", "type": "str"}, "type": {"key": "type", "type": "str"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedIdentityDetails}"}, } - def __init__(self, *, type: Optional[str] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + type: Optional[str] = None, + user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentityDetails"]] = None, + **kwargs: Any + ) -> None: """ - :keyword type: The identityType which can be either SystemAssigned or None. + :keyword type: The identityType which can be either SystemAssigned, UserAssigned, + 'SystemAssigned,UserAssigned' or None. :paramtype type: str + :keyword user_assigned_identities: Gets or sets the user assigned identities. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.dataprotection.models.UserAssignedIdentityDetails] """ super().__init__(**kwargs) self.principal_id = None self.tenant_id = None self.type = type + self.user_assigned_identities = user_assigned_identities class DppTrackedResourceList(_serialization.Model): @@ -3665,6 +3908,9 @@ class FeatureSettings(_serialization.Model): :ivar cross_subscription_restore_settings: CrossSubscriptionRestore Settings. :vartype cross_subscription_restore_settings: ~azure.mgmt.dataprotection.models.CrossSubscriptionRestoreSettings + :ivar cross_region_restore_settings: + :vartype cross_region_restore_settings: + ~azure.mgmt.dataprotection.models.CrossRegionRestoreSettings """ _attribute_map = { @@ -3672,21 +3918,27 @@ class FeatureSettings(_serialization.Model): "key": "crossSubscriptionRestoreSettings", "type": "CrossSubscriptionRestoreSettings", }, + "cross_region_restore_settings": {"key": "crossRegionRestoreSettings", "type": "CrossRegionRestoreSettings"}, } def __init__( self, *, cross_subscription_restore_settings: Optional["_models.CrossSubscriptionRestoreSettings"] = None, + cross_region_restore_settings: Optional["_models.CrossRegionRestoreSettings"] = None, **kwargs: Any ) -> None: """ :keyword cross_subscription_restore_settings: CrossSubscriptionRestore Settings. :paramtype cross_subscription_restore_settings: ~azure.mgmt.dataprotection.models.CrossSubscriptionRestoreSettings + :keyword cross_region_restore_settings: + :paramtype cross_region_restore_settings: + ~azure.mgmt.dataprotection.models.CrossRegionRestoreSettings """ super().__init__(**kwargs) self.cross_subscription_restore_settings = cross_subscription_restore_settings + self.cross_region_restore_settings = cross_region_restore_settings class FeatureValidationRequestBase(_serialization.Model): @@ -3833,6 +4085,68 @@ def __init__( self.features = features +class FetchSecondaryRPsRequestParameters(_serialization.Model): + """Information about BI whose secondary RecoveryPoints are requested + Source region and + BI ARM path. + + :ivar source_region: Source region in which BackupInstance is located. + :vartype source_region: str + :ivar source_backup_instance_id: ARM Path of BackupInstance. + :vartype source_backup_instance_id: str + """ + + _attribute_map = { + "source_region": {"key": "sourceRegion", "type": "str"}, + "source_backup_instance_id": {"key": "sourceBackupInstanceId", "type": "str"}, + } + + def __init__( + self, *, source_region: Optional[str] = None, source_backup_instance_id: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword source_region: Source region in which BackupInstance is located. + :paramtype source_region: str + :keyword source_backup_instance_id: ARM Path of BackupInstance. + :paramtype source_backup_instance_id: str + """ + super().__init__(**kwargs) + self.source_region = source_region + self.source_backup_instance_id = source_backup_instance_id + + +class IdentityDetails(_serialization.Model): + """IdentityDetails. + + :ivar use_system_assigned_identity: Specifies if the BI is protected by System Identity. + :vartype use_system_assigned_identity: bool + :ivar user_assigned_identity_arm_url: ARM URL for User Assigned Identity. + :vartype user_assigned_identity_arm_url: str + """ + + _attribute_map = { + "use_system_assigned_identity": {"key": "useSystemAssignedIdentity", "type": "bool"}, + "user_assigned_identity_arm_url": {"key": "userAssignedIdentityArmUrl", "type": "str"}, + } + + def __init__( + self, + *, + use_system_assigned_identity: Optional[bool] = None, + user_assigned_identity_arm_url: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword use_system_assigned_identity: Specifies if the BI is protected by System Identity. + :paramtype use_system_assigned_identity: bool + :keyword user_assigned_identity_arm_url: ARM URL for User Assigned Identity. + :paramtype user_assigned_identity_arm_url: str + """ + super().__init__(**kwargs) + self.use_system_assigned_identity = use_system_assigned_identity + self.user_assigned_identity_arm_url = user_assigned_identity_arm_url + + class ImmediateCopyOption(CopyOption): """Immediate copy Option. @@ -5169,6 +5483,165 @@ def __init__(self, **kwargs: Any) -> None: self.request_resource_type = None +class ResourceGuardOperationDetail(_serialization.Model): + """VaultCritical Operation protected by a resource guard. + + :ivar vault_critical_operation: + :vartype vault_critical_operation: str + :ivar default_resource_request: + :vartype default_resource_request: str + """ + + _attribute_map = { + "vault_critical_operation": {"key": "vaultCriticalOperation", "type": "str"}, + "default_resource_request": {"key": "defaultResourceRequest", "type": "str"}, + } + + def __init__( + self, + *, + vault_critical_operation: Optional[str] = None, + default_resource_request: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword vault_critical_operation: + :paramtype vault_critical_operation: str + :keyword default_resource_request: + :paramtype default_resource_request: str + """ + super().__init__(**kwargs) + self.vault_critical_operation = vault_critical_operation + self.default_resource_request = default_resource_request + + +class ResourceGuardProxyBase(_serialization.Model): + """ResourceGuardProxyBase object, used in ResourceGuardProxyBaseResource. + + :ivar resource_guard_resource_id: + :vartype resource_guard_resource_id: str + :ivar resource_guard_operation_details: + :vartype resource_guard_operation_details: + list[~azure.mgmt.dataprotection.models.ResourceGuardOperationDetail] + :ivar last_updated_time: + :vartype last_updated_time: str + :ivar description: + :vartype description: str + """ + + _attribute_map = { + "resource_guard_resource_id": {"key": "resourceGuardResourceId", "type": "str"}, + "resource_guard_operation_details": { + "key": "resourceGuardOperationDetails", + "type": "[ResourceGuardOperationDetail]", + }, + "last_updated_time": {"key": "lastUpdatedTime", "type": "str"}, + "description": {"key": "description", "type": "str"}, + } + + def __init__( + self, + *, + resource_guard_resource_id: Optional[str] = None, + resource_guard_operation_details: Optional[List["_models.ResourceGuardOperationDetail"]] = None, + last_updated_time: Optional[str] = None, + description: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword resource_guard_resource_id: + :paramtype resource_guard_resource_id: str + :keyword resource_guard_operation_details: + :paramtype resource_guard_operation_details: + list[~azure.mgmt.dataprotection.models.ResourceGuardOperationDetail] + :keyword last_updated_time: + :paramtype last_updated_time: str + :keyword description: + :paramtype description: str + """ + super().__init__(**kwargs) + self.resource_guard_resource_id = resource_guard_resource_id + self.resource_guard_operation_details = resource_guard_operation_details + self.last_updated_time = last_updated_time + self.description = description + + +class ResourceGuardProxyBaseResource(DppResource): + """ResourceGuardProxyBaseResource object, used for response and request bodies for + ResourceGuardProxy APIs. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id represents the complete path to the resource. + :vartype id: str + :ivar name: Resource name associated with the resource. + :vartype name: str + :ivar type: Resource type represents the complete path of the form + Namespace/ResourceType/ResourceType/... + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.dataprotection.models.SystemData + :ivar properties: ResourceGuardProxyBaseResource properties. + :vartype properties: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBase + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "properties": {"key": "properties", "type": "ResourceGuardProxyBase"}, + } + + def __init__(self, *, properties: Optional["_models.ResourceGuardProxyBase"] = None, **kwargs: Any) -> None: + """ + :keyword properties: ResourceGuardProxyBaseResource properties. + :paramtype properties: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBase + """ + super().__init__(**kwargs) + self.properties = properties + + +class ResourceGuardProxyBaseResourceList(DppResourceList): + """List of ResourceGuardProxyBase resources. + + :ivar next_link: The uri to fetch the next page of resources. Call ListNext() fetches next page + of resources. + :vartype next_link: str + :ivar value: List of resources. + :vartype value: list[~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource] + """ + + _attribute_map = { + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[ResourceGuardProxyBaseResource]"}, + } + + def __init__( + self, + *, + next_link: Optional[str] = None, + value: Optional[List["_models.ResourceGuardProxyBaseResource"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword next_link: The uri to fetch the next page of resources. Call ListNext() fetches next + page of resources. + :paramtype next_link: str + :keyword value: List of resources. + :paramtype value: list[~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource] + """ + super().__init__(next_link=next_link, **kwargs) + self.value = value + + class ResourceGuardResource(DppBaseTrackedResource): """ResourceGuardResource. @@ -6213,6 +6686,88 @@ def __init__(self, *, backup_rule_options: "_models.AdHocBackupRuleOptions", **k self.backup_rule_options = backup_rule_options +class UnlockDeleteRequest(_serialization.Model): + """Request body of unlock delete API. + + :ivar resource_guard_operation_requests: + :vartype resource_guard_operation_requests: list[str] + :ivar resource_to_be_deleted: + :vartype resource_to_be_deleted: str + """ + + _attribute_map = { + "resource_guard_operation_requests": {"key": "resourceGuardOperationRequests", "type": "[str]"}, + "resource_to_be_deleted": {"key": "resourceToBeDeleted", "type": "str"}, + } + + def __init__( + self, + *, + resource_guard_operation_requests: Optional[List[str]] = None, + resource_to_be_deleted: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword resource_guard_operation_requests: + :paramtype resource_guard_operation_requests: list[str] + :keyword resource_to_be_deleted: + :paramtype resource_to_be_deleted: str + """ + super().__init__(**kwargs) + self.resource_guard_operation_requests = resource_guard_operation_requests + self.resource_to_be_deleted = resource_to_be_deleted + + +class UnlockDeleteResponse(_serialization.Model): + """Response of Unlock Delete API. + + :ivar unlock_delete_expiry_time: This is the time when unlock delete privileges will get + expired. + :vartype unlock_delete_expiry_time: str + """ + + _attribute_map = { + "unlock_delete_expiry_time": {"key": "unlockDeleteExpiryTime", "type": "str"}, + } + + def __init__(self, *, unlock_delete_expiry_time: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword unlock_delete_expiry_time: This is the time when unlock delete privileges will get + expired. + :paramtype unlock_delete_expiry_time: str + """ + super().__init__(**kwargs) + self.unlock_delete_expiry_time = unlock_delete_expiry_time + + +class UserAssignedIdentityDetails(_serialization.Model): + """User Assigned Identity Details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar client_id: The Client Id of the User Assigned Managed Identity. + :vartype client_id: str + :ivar principal_id: The Object Id of the User Assigned Managed Identity. + :vartype principal_id: str + """ + + _validation = { + "client_id": {"readonly": True}, + "principal_id": {"readonly": True}, + } + + _attribute_map = { + "client_id": {"key": "clientId", "type": "str"}, + "principal_id": {"key": "principalId", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.client_id = None + self.principal_id = None + + class UserFacingError(_serialization.Model): """Error object used by layers that have access to localized content, and propagate that to user. @@ -6294,6 +6849,47 @@ def __init__( self.target = target +class ValidateCrossRegionRestoreRequestObject(_serialization.Model): + """Cross Region Restore Request Object. + + All required parameters must be populated in order to send to Azure. + + :ivar restore_request_object: Gets or sets the restore request object. Required. + :vartype restore_request_object: ~azure.mgmt.dataprotection.models.AzureBackupRestoreRequest + :ivar cross_region_restore_details: Cross region restore details. Required. + :vartype cross_region_restore_details: + ~azure.mgmt.dataprotection.models.CrossRegionRestoreDetails + """ + + _validation = { + "restore_request_object": {"required": True}, + "cross_region_restore_details": {"required": True}, + } + + _attribute_map = { + "restore_request_object": {"key": "restoreRequestObject", "type": "AzureBackupRestoreRequest"}, + "cross_region_restore_details": {"key": "crossRegionRestoreDetails", "type": "CrossRegionRestoreDetails"}, + } + + def __init__( + self, + *, + restore_request_object: "_models.AzureBackupRestoreRequest", + cross_region_restore_details: "_models.CrossRegionRestoreDetails", + **kwargs: Any + ) -> None: + """ + :keyword restore_request_object: Gets or sets the restore request object. Required. + :paramtype restore_request_object: ~azure.mgmt.dataprotection.models.AzureBackupRestoreRequest + :keyword cross_region_restore_details: Cross region restore details. Required. + :paramtype cross_region_restore_details: + ~azure.mgmt.dataprotection.models.CrossRegionRestoreDetails + """ + super().__init__(**kwargs) + self.restore_request_object = restore_request_object + self.cross_region_restore_details = cross_region_restore_details + + class ValidateForBackupRequest(_serialization.Model): """Validate for backup request. 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 6775e75af5a7..cb814364d2ce 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 @@ -17,12 +17,17 @@ from ._backup_policies_operations import BackupPoliciesOperations from ._backup_instances_operations import BackupInstancesOperations from ._recovery_points_operations import RecoveryPointsOperations +from ._secondary_rps_operations import SecondaryRPsOperations +from ._cross_region_restore_job_operations import CrossRegionRestoreJobOperations +from ._cross_region_restore_jobs_operations import CrossRegionRestoreJobsOperations +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 ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -40,12 +45,17 @@ "BackupPoliciesOperations", "BackupInstancesOperations", "RecoveryPointsOperations", + "SecondaryRPsOperations", + "CrossRegionRestoreJobOperations", + "CrossRegionRestoreJobsOperations", + "BackupInstancesExtensionRoutingOperations", "JobsOperations", "RestorableTimeRangesOperations", "ExportJobsOperations", "ExportJobsOperationResultOperations", "DeletedBackupInstancesOperations", "ResourceGuardsOperations", + "DppResourceGuardProxyOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _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 new file mode 100644 index 000000000000..5d7e39dcd821 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_instances_extension_routing_operations.py @@ -0,0 +1,164 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +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", "2023-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/{resourceId}/providers/Microsoft.DataProtection/backupInstances") + path_format_arguments = { + "resourceId": _SERIALIZER.url("resource_id", resource_id, "str", skip_quote=True), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class BackupInstancesExtensionRoutingOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.dataprotection.DataProtectionMgmtClient`'s + :attr:`backup_instances_extension_routing` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, resource_id: str, **kwargs: Any) -> Iterable["_models.BackupInstanceResource"]: + """Gets a list of backup instances associated with a tracked resource. + + :param resource_id: ARM path of the resource to be protected using Microsoft.DataProtection. + Required. + :type resource_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BackupInstanceResource or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.BackupInstanceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = 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)) + cls: ClsType[_models.BackupInstanceResourceList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_id=resource_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + 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 + + def extract_data(pipeline_response): + deserialized = self._deserialize("BackupInstanceResourceList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + 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 [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/{resourceId}/providers/Microsoft.DataProtection/backupInstances"} 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 4785178319a5..35b180b6dc6e 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -32,10 +31,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,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: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -80,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: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -114,7 +109,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: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -151,7 +146,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -185,7 +180,7 @@ def build_adhoc_backup_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -222,7 +217,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: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -252,7 +247,7 @@ def build_validate_for_backup_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_backup_instance_operation_result_request( +def build_get_backup_instance_operation_result_request( # pylint: disable=name-too-long resource_group_name: str, vault_name: str, backup_instance_name: str, @@ -263,7 +258,7 @@ def build_get_backup_instance_operation_result_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -292,13 +287,85 @@ def build_get_backup_instance_operation_result_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) +def build_trigger_cross_region_restore_request( # pylint: disable=name-too-long + resource_group_name: str, location: 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", "2023-04-01-preview")) + 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/locations/{location}/crossRegionRestore", + ) # 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 + ), + "location": _SERIALIZER.url("location", location, "str"), + } + + _url: str = _format_url_section(_url, **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_validate_cross_region_restore_request( # pylint: disable=name-too-long + resource_group_name: str, location: 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", "2023-04-01-preview")) + 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/locations/{location}/validateCrossRegionRestore", + ) # 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 + ), + "location": _SERIALIZER.url("location", location, "str"), + } + + _url: str = _format_url_section(_url, **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_trigger_rehydrate_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: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -335,7 +402,7 @@ def build_trigger_restore_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -372,7 +439,7 @@ def build_resume_backups_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -406,7 +473,7 @@ def build_resume_protection_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -440,7 +507,7 @@ def build_stop_protection_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -474,7 +541,7 @@ def build_suspend_backups_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -508,7 +575,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: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -545,7 +612,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: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -615,9 +682,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -671,8 +736,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -717,9 +783,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BackupInstanceResource] = kwargs.pop("cls", None) request = build_get_request( @@ -735,8 +799,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -775,9 +840,7 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -805,8 +868,9 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -956,9 +1020,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.BackupInstanceResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1018,9 +1080,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -1036,8 +1096,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1089,9 +1150,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) 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) @@ -1151,9 +1210,7 @@ def _adhoc_backup_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -1181,8 +1238,9 @@ def _adhoc_backup_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1333,9 +1391,7 @@ def begin_adhoc_backup( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.OperationJobExtendedInfo] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1399,9 +1455,7 @@ def _validate_for_backup_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -1428,8 +1482,9 @@ def _validate_for_backup_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1571,9 +1626,7 @@ def begin_validate_for_backup( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.OperationJobExtendedInfo] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1649,9 +1702,7 @@ def get_backup_instance_operation_result( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Optional[_models.BackupInstanceResource]] = kwargs.pop("cls", None) request = build_get_backup_instance_operation_result_request( @@ -1668,8 +1719,9 @@ def get_backup_instance_operation_result( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1691,6 +1743,479 @@ def get_backup_instance_operation_result( "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/operationResults/{operationId}" } + def _trigger_cross_region_restore_initial( + self, + resource_group_name: str, + location: str, + parameters: Union[_models.CrossRegionRestoreRequestObject, IO], + **kwargs: Any + ) -> Optional[_models.OperationJobExtendedInfo]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CrossRegionRestoreRequestObject") + + request = build_trigger_cross_region_restore_request( + resource_group_name=resource_group_name, + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._trigger_cross_region_restore_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + 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 [200, 202]: + 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( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _trigger_cross_region_restore_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/locations/{location}/crossRegionRestore" + } + + @overload + def begin_trigger_cross_region_restore( + self, + resource_group_name: str, + location: str, + parameters: _models.CrossRegionRestoreRequestObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationJobExtendedInfo]: + """trigger_cross_region_restore. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: Required. + :type location: str + :param parameters: Request body for trigger CRR operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.CrossRegionRestoreRequestObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OperationJobExtendedInfo or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_trigger_cross_region_restore( + self, + resource_group_name: str, + location: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationJobExtendedInfo]: + """trigger_cross_region_restore. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: Required. + :type location: str + :param parameters: Request body for trigger CRR operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OperationJobExtendedInfo or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_trigger_cross_region_restore( + self, + resource_group_name: str, + location: str, + parameters: Union[_models.CrossRegionRestoreRequestObject, IO], + **kwargs: Any + ) -> LROPoller[_models.OperationJobExtendedInfo]: + """trigger_cross_region_restore. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: Required. + :type location: str + :param parameters: Request body for trigger CRR operation. Is either a + CrossRegionRestoreRequestObject type or a IO type. Required. + :type parameters: ~azure.mgmt.dataprotection.models.CrossRegionRestoreRequestObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OperationJobExtendedInfo or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :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[_models.OperationJobExtendedInfo] = 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._trigger_cross_region_restore_initial( + resource_group_name=resource_group_name, + location=location, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("OperationJobExtendedInfo", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + 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.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_trigger_cross_region_restore.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/locations/{location}/crossRegionRestore" + } + + def _validate_cross_region_restore_initial( + self, + resource_group_name: str, + location: str, + parameters: Union[_models.ValidateCrossRegionRestoreRequestObject, IO], + **kwargs: Any + ) -> Optional[_models.OperationJobExtendedInfo]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ValidateCrossRegionRestoreRequestObject") + + request = build_validate_cross_region_restore_request( + resource_group_name=resource_group_name, + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._validate_cross_region_restore_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + 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 [200, 202]: + 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( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _validate_cross_region_restore_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/locations/{location}/validateCrossRegionRestore" + } + + @overload + def begin_validate_cross_region_restore( + self, + resource_group_name: str, + location: str, + parameters: _models.ValidateCrossRegionRestoreRequestObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationJobExtendedInfo]: + """validate_cross_region_restore. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: Required. + :type location: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.ValidateCrossRegionRestoreRequestObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OperationJobExtendedInfo or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_validate_cross_region_restore( + self, + resource_group_name: str, + location: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationJobExtendedInfo]: + """validate_cross_region_restore. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: Required. + :type location: str + :param parameters: Request body for operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OperationJobExtendedInfo or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_validate_cross_region_restore( + self, + resource_group_name: str, + location: str, + parameters: Union[_models.ValidateCrossRegionRestoreRequestObject, IO], + **kwargs: Any + ) -> LROPoller[_models.OperationJobExtendedInfo]: + """validate_cross_region_restore. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: Required. + :type location: str + :param parameters: Request body for operation. Is either a + ValidateCrossRegionRestoreRequestObject type or a IO type. Required. + :type parameters: ~azure.mgmt.dataprotection.models.ValidateCrossRegionRestoreRequestObject or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OperationJobExtendedInfo or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :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[_models.OperationJobExtendedInfo] = 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_cross_region_restore_initial( + resource_group_name=resource_group_name, + location=location, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("OperationJobExtendedInfo", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + 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.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_validate_cross_region_restore.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/locations/{location}/validateCrossRegionRestore" + } + def _trigger_rehydrate_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, @@ -1710,9 +2235,7 @@ def _trigger_rehydrate_initial( # pylint: disable=inconsistent-return-statement _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -1740,8 +2263,9 @@ def _trigger_rehydrate_initial( # pylint: disable=inconsistent-return-statement request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1880,9 +2404,7 @@ def begin_trigger_rehydrate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -1945,9 +2467,7 @@ def _trigger_restore_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -1975,8 +2495,9 @@ def _trigger_restore_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2127,9 +2648,7 @@ def begin_trigger_restore( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.OperationJobExtendedInfo] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -2189,9 +2708,7 @@ def _resume_backups_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_resume_backups_request( @@ -2207,8 +2724,9 @@ def _resume_backups_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2260,9 +2778,7 @@ def begin_resume_backups( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) 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) @@ -2317,9 +2833,7 @@ def _resume_protection_initial( # pylint: disable=inconsistent-return-statement _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_resume_protection_request( @@ -2335,8 +2849,9 @@ def _resume_protection_initial( # pylint: disable=inconsistent-return-statement request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2388,9 +2903,7 @@ def begin_resume_protection( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) 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) @@ -2445,9 +2958,7 @@ def _stop_protection_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_stop_protection_request( @@ -2463,8 +2974,9 @@ def _stop_protection_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2516,9 +3028,7 @@ def begin_stop_protection( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) 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) @@ -2573,9 +3083,7 @@ def _suspend_backups_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_suspend_backups_request( @@ -2591,8 +3099,9 @@ def _suspend_backups_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2645,9 +3154,7 @@ def begin_suspend_backups( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) 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) @@ -2707,9 +3214,7 @@ def _sync_backup_instance_initial( # pylint: disable=inconsistent-return-statem _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -2737,8 +3242,9 @@ def _sync_backup_instance_initial( # pylint: disable=inconsistent-return-statem request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2880,9 +3386,7 @@ def begin_sync_backup_instance( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -2945,9 +3449,7 @@ def _validate_for_restore_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -2975,8 +3477,9 @@ def _validate_for_restore_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -3127,9 +3630,7 @@ def begin_validate_for_restore( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.OperationJobExtendedInfo] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) 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 835efc4331cb..3268f4643994 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,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: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +73,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -112,7 +107,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: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -149,7 +144,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -217,9 +212,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -273,8 +266,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -321,9 +315,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BaseBackupPolicyResource] = kwargs.pop("cls", None) request = build_get_request( @@ -339,8 +331,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -468,9 +461,7 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.BaseBackupPolicyResource] = kwargs.pop("cls", None) @@ -498,8 +489,9 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -550,9 +542,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -568,8 +558,9 @@ def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 a9863ab574be..53c04a46e287 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -121,9 +116,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Optional[_models.BackupVaultResource]] = kwargs.pop("cls", None) request = build_get_request( @@ -139,8 +132,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 f25727eeb665..93d60eb24e7a 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -32,10 +31,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +42,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: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -71,7 +66,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: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -101,7 +96,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: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -134,7 +129,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: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -168,7 +163,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: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -199,7 +194,7 @@ def build_update_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: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -235,7 +230,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: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -296,9 +291,7 @@ def get_in_subscription(self, **kwargs: Any) -> Iterable["_models.BackupVaultRes _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -350,8 +343,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -382,9 +376,7 @@ def get_in_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iter _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -437,8 +429,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -479,9 +472,7 @@ def get(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> _mode _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BackupVaultResource] = kwargs.pop("cls", None) request = build_get_request( @@ -496,8 +487,9 @@ def get(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> _mode request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -535,9 +527,7 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -564,8 +554,9 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -698,9 +689,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -759,9 +748,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -776,8 +763,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -817,9 +805,7 @@ def begin_delete(self, resource_group_name: str, vault_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) 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) @@ -877,9 +863,7 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -906,8 +890,9 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1041,9 +1026,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1187,9 +1170,7 @@ def check_name_availability( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.CheckNameAvailabilityResult] = kwargs.pop("cls", None) @@ -1216,8 +1197,9 @@ def check_name_availability( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_cross_region_restore_job_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_cross_region_restore_job_operations.py new file mode 100644 index 000000000000..21c7925d9e20 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_cross_region_restore_job_operations.py @@ -0,0 +1,230 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request(resource_group_name: str, location: 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", "2023-04-01-preview")) + 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/locations/{location}/fetchCrossRegionRestoreJob", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + } + + _url: str = _format_url_section(_url, **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) + + +class CrossRegionRestoreJobOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.dataprotection.DataProtectionMgmtClient`'s + :attr:`cross_region_restore_job` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + def get( + self, + resource_group_name: str, + location: str, + parameters: _models.CrossRegionRestoreJobRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AzureBackupJobResource: + """get. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: Required. + :type location: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.CrossRegionRestoreJobRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AzureBackupJobResource or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.AzureBackupJobResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def get( + self, + resource_group_name: str, + location: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AzureBackupJobResource: + """get. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: Required. + :type location: str + :param parameters: Request body for operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AzureBackupJobResource or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.AzureBackupJobResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def get( + self, + resource_group_name: str, + location: str, + parameters: Union[_models.CrossRegionRestoreJobRequest, IO], + **kwargs: Any + ) -> _models.AzureBackupJobResource: + """get. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: Required. + :type location: str + :param parameters: Request body for operation. Is either a CrossRegionRestoreJobRequest type or + a IO type. Required. + :type parameters: ~azure.mgmt.dataprotection.models.CrossRegionRestoreJobRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AzureBackupJobResource or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.AzureBackupJobResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.AzureBackupJobResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CrossRegionRestoreJobRequest") + + request = build_get_request( + resource_group_name=resource_group_name, + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + 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 [200]: + 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) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/locations/{location}/fetchCrossRegionRestoreJob" + } diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_cross_region_restore_jobs_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_cross_region_restore_jobs_operations.py new file mode 100644 index 000000000000..8cbb69f8d63d --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_cross_region_restore_jobs_operations.py @@ -0,0 +1,261 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request(resource_group_name: str, location: 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", "2023-04-01-preview")) + 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/locations/{location}/fetchCrossRegionRestoreJobs", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + } + + _url: str = _format_url_section(_url, **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) + + +class CrossRegionRestoreJobsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.dataprotection.DataProtectionMgmtClient`'s + :attr:`cross_region_restore_jobs` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + def list( + self, + resource_group_name: str, + location: str, + parameters: _models.CrossRegionRestoreJobsRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Iterable["_models.AzureBackupJobResource"]: + """list. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: Required. + :type location: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.CrossRegionRestoreJobsRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AzureBackupJobResource or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.AzureBackupJobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def list( + self, + resource_group_name: str, + location: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Iterable["_models.AzureBackupJobResource"]: + """list. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: Required. + :type location: str + :param parameters: Request body for operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AzureBackupJobResource or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.AzureBackupJobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def list( + self, + resource_group_name: str, + location: str, + parameters: Union[_models.CrossRegionRestoreJobsRequest, IO], + **kwargs: Any + ) -> Iterable["_models.AzureBackupJobResource"]: + """list. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: Required. + :type location: str + :param parameters: Request body for operation. Is either a CrossRegionRestoreJobsRequest type + or a IO type. Required. + :type parameters: ~azure.mgmt.dataprotection.models.CrossRegionRestoreJobsRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AzureBackupJobResource or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.AzureBackupJobResource] + :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[_models.AzureBackupJobResourceList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CrossRegionRestoreJobsRequest") + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + 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 + + def extract_data(pipeline_response): + deserialized = self._deserialize("AzureBackupJobResourceList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + 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 [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/locations/{location}/fetchCrossRegionRestoreJobs" + } 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 af12a800b855..4b1176b0c12b 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +38,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: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -168,9 +163,7 @@ def check_feature_support( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.FeatureValidationResponseBase] = kwargs.pop("cls", None) @@ -196,8 +189,9 @@ def check_feature_support( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 f8d0cd0e8dd8..e21a086d8fcd 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,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: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,9 +88,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.ClientDiscoveryValueForSingle _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -146,8 +139,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 1684d35cb8c9..00557099e43d 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast import urllib.parse @@ -32,10 +31,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,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: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -80,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: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -114,7 +109,7 @@ def build_undelete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -182,9 +177,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -238,8 +231,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -284,9 +278,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DeletedBackupInstanceResource] = kwargs.pop("cls", None) request = build_get_request( @@ -302,8 +294,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -337,9 +330,7 @@ def _undelete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_undelete_request( @@ -355,8 +346,9 @@ def _undelete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -400,9 +392,7 @@ def begin_undelete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) 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) 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 new file mode 100644 index 000000000000..b4aecdb327a9 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_dpp_resource_guard_proxy_operations.py @@ -0,0 +1,784 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request(resource_group_name: str, vault_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", "2023-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies", + ) # 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"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, vault_name: str, resource_guard_proxy_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", "2023-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}", + ) # 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"), + "resourceGuardProxyName": _SERIALIZER.url( + "resource_guard_proxy_name", resource_guard_proxy_name, "str", pattern=r"^[A-Za-z0-9]*$" + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, vault_name: str, resource_guard_proxy_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", "2023-04-01-preview")) + 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}/backupResourceGuardProxies/{resourceGuardProxyName}", + ) # 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"), + "resourceGuardProxyName": _SERIALIZER.url( + "resource_guard_proxy_name", resource_guard_proxy_name, "str", pattern=r"^[A-Za-z0-9]*$" + ), + } + + _url: str = _format_url_section(_url, **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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, vault_name: str, resource_guard_proxy_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", "2023-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}", + ) # 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"), + "resourceGuardProxyName": _SERIALIZER.url( + "resource_guard_proxy_name", resource_guard_proxy_name, "str", pattern=r"^[A-Za-z0-9]*$" + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_unlock_delete_request( + resource_group_name: str, vault_name: str, resource_guard_proxy_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", "2023-04-01-preview")) + 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}/backupResourceGuardProxies/{resourceGuardProxyName}/unlockDelete", + ) # 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"), + "resourceGuardProxyName": _SERIALIZER.url( + "resource_guard_proxy_name", resource_guard_proxy_name, "str", pattern=r"^[A-Za-z0-9]*$" + ), + } + + _url: str = _format_url_section(_url, **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) + + +class DppResourceGuardProxyOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.dataprotection.DataProtectionMgmtClient`'s + :attr:`dpp_resource_guard_proxy` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, vault_name: str, **kwargs: Any + ) -> Iterable["_models.ResourceGuardProxyBaseResource"]: + """Returns the list of ResourceGuardProxies associated with the vault. + + Returns the list of ResourceGuardProxies associated with the vault. + + :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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceGuardProxyBaseResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = 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)) + cls: ClsType[_models.ResourceGuardProxyBaseResourceList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + 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 + + def extract_data(pipeline_response): + deserialized = self._deserialize("ResourceGuardProxyBaseResourceList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + 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 [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies" + } + + @distributed_trace + def get( + self, resource_group_name: str, vault_name: str, resource_guard_proxy_name: str, **kwargs: Any + ) -> _models.ResourceGuardProxyBaseResource: + """Returns the ResourceGuardProxy object associated with the vault, and that matches the name in + the request. + + Returns the ResourceGuardProxy object associated with the vault, and that matches the name in + the request. + + :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 resource_guard_proxy_name: name of the resource guard proxy. Required. + :type resource_guard_proxy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceGuardProxyBaseResource or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = 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)) + cls: ClsType[_models.ResourceGuardProxyBaseResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + resource_guard_proxy_name=resource_guard_proxy_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + 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 [200]: + 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) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + vault_name: str, + resource_guard_proxy_name: str, + parameters: _models.ResourceGuardProxyBaseResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ResourceGuardProxyBaseResource: + """Creates or Updates a ResourceGuardProxy. + + Creates or Updates a ResourceGuardProxy. + + :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 resource_guard_proxy_name: name of the resource guard proxy. Required. + :type resource_guard_proxy_name: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceGuardProxyBaseResource or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + vault_name: str, + resource_guard_proxy_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ResourceGuardProxyBaseResource: + """Creates or Updates a ResourceGuardProxy. + + Creates or Updates a ResourceGuardProxy. + + :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 resource_guard_proxy_name: name of the resource guard proxy. Required. + :type resource_guard_proxy_name: str + :param parameters: Request body for operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceGuardProxyBaseResource or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + vault_name: str, + resource_guard_proxy_name: str, + parameters: Union[_models.ResourceGuardProxyBaseResource, IO], + **kwargs: Any + ) -> _models.ResourceGuardProxyBaseResource: + """Creates or Updates a ResourceGuardProxy. + + Creates or Updates a ResourceGuardProxy. + + :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 resource_guard_proxy_name: name of the resource guard proxy. Required. + :type resource_guard_proxy_name: str + :param parameters: Request body for operation. Is either a ResourceGuardProxyBaseResource type + or a IO type. Required. + :type parameters: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceGuardProxyBaseResource or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.ResourceGuardProxyBaseResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ResourceGuardProxyBaseResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + resource_guard_proxy_name=resource_guard_proxy_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + 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 [200]: + 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) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, vault_name: str, resource_guard_proxy_name: str, **kwargs: Any + ) -> None: + """Deletes the ResourceGuardProxy. + + Deletes the ResourceGuardProxy. + + :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 resource_guard_proxy_name: name of the resource guard proxy. Required. + :type resource_guard_proxy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = 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)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + resource_guard_proxy_name=resource_guard_proxy_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + 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 [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}" + } + + @overload + def unlock_delete( + self, + resource_group_name: str, + vault_name: str, + resource_guard_proxy_name: str, + parameters: _models.UnlockDeleteRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.UnlockDeleteResponse: + """UnlockDelete call for ResourceGuardProxy, executed before one can delete it. + + UnlockDelete call for ResourceGuardProxy, executed before one can delete it. + + :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 resource_guard_proxy_name: name of the resource guard proxy. Required. + :type resource_guard_proxy_name: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.UnlockDeleteRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: UnlockDeleteResponse or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.UnlockDeleteResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def unlock_delete( + self, + resource_group_name: str, + vault_name: str, + resource_guard_proxy_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.UnlockDeleteResponse: + """UnlockDelete call for ResourceGuardProxy, executed before one can delete it. + + UnlockDelete call for ResourceGuardProxy, executed before one can delete it. + + :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 resource_guard_proxy_name: name of the resource guard proxy. Required. + :type resource_guard_proxy_name: str + :param parameters: Request body for operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: UnlockDeleteResponse or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.UnlockDeleteResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def unlock_delete( + self, + resource_group_name: str, + vault_name: str, + resource_guard_proxy_name: str, + parameters: Union[_models.UnlockDeleteRequest, IO], + **kwargs: Any + ) -> _models.UnlockDeleteResponse: + """UnlockDelete call for ResourceGuardProxy, executed before one can delete it. + + UnlockDelete call for ResourceGuardProxy, executed before one can delete it. + + :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 resource_guard_proxy_name: name of the resource guard proxy. Required. + :type resource_guard_proxy_name: str + :param parameters: Request body for operation. Is either a UnlockDeleteRequest type or a IO + type. Required. + :type parameters: ~azure.mgmt.dataprotection.models.UnlockDeleteRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: UnlockDeleteResponse or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.UnlockDeleteResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.UnlockDeleteResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "UnlockDeleteRequest") + + request = build_unlock_delete_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + resource_guard_proxy_name=resource_guard_proxy_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.unlock_delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + 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 [200]: + 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) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + unlock_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}/unlockDelete" + } 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 ee4c8bc4c22f..4a89db42be37 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -123,9 +118,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Optional[_models.ExportJobsResult]] = kwargs.pop("cls", None) request = build_get_request( @@ -141,8 +134,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 f9b98b8f27c0..9be562083e98 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.exceptions import ( @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +42,7 @@ def build_trigger_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -107,9 +102,7 @@ def _trigger_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_trigger_request( @@ -124,8 +117,9 @@ def _trigger_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -170,9 +164,7 @@ def begin_trigger(self, resource_group_name: str, vault_name: str, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) 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) 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 175f6d3e2641..6064a6e9e6ca 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,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: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +73,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -145,9 +140,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -201,8 +194,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -248,9 +242,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AzureBackupJobResource] = kwargs.pop("cls", None) request = build_get_request( @@ -266,8 +258,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 9d8abf9159ef..87df6776b5ff 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +38,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: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -113,9 +108,7 @@ def get(self, operation_id: str, location: str, **kwargs: Any) -> Optional[_mode _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Optional[_models.OperationJobExtendedInfo]] = kwargs.pop("cls", None) request = build_get_request( @@ -130,8 +123,9 @@ def get(self, operation_id: str, location: str, **kwargs: Any) -> Optional[_mode request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 b740da95abb5..560b1a293a72 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -123,9 +118,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationResource] = kwargs.pop("cls", None) request = build_get_request( @@ -141,8 +134,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 536cc4c0b384..259025b401c3 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +38,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: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -113,9 +108,7 @@ def get(self, location: str, operation_id: str, **kwargs: Any) -> _models.Operat _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationResource] = kwargs.pop("cls", None) request = build_get_request( @@ -130,8 +123,9 @@ def get(self, location: str, operation_id: str, **kwargs: Any) -> _models.Operat request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 06e17f96fc26..0398b148c10e 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +38,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: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -116,9 +111,7 @@ def get(self, resource_group_name: str, operation_id: str, **kwargs: Any) -> _mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationResource] = kwargs.pop("cls", None) request = build_get_request( @@ -133,8 +126,9 @@ def get(self, resource_group_name: str, operation_id: str, **kwargs: Any) -> _mo request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 ffd71b60bb89..31c997be8ce8 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -54,7 +49,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +92,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -178,9 +173,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -237,8 +230,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -290,9 +284,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AzureBackupRecoveryPointResource] = kwargs.pop("cls", None) request = build_get_request( @@ -309,8 +301,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 80fc87757ec8..f2612e11b1f3 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,11 +36,13 @@ _SERIALIZER.client_side_validation = False -def build_get_resources_in_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_get_resources_in_subscription_request( # pylint: disable=name-too-long + subscription_id: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -67,13 +64,13 @@ def build_get_resources_in_subscription_request(subscription_id: str, **kwargs: return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_resources_in_resource_group_request( +def build_get_resources_in_resource_group_request( # pylint: disable=name-too-long resource_group_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: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -105,7 +102,7 @@ def build_put_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -141,7 +138,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -174,7 +171,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -207,7 +204,7 @@ def build_patch_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -237,13 +234,13 @@ def build_patch_request( return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_disable_soft_delete_requests_objects_request( +def build_get_disable_soft_delete_requests_objects_request( # pylint: disable=name-too-long resource_group_name: str, resource_guards_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: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -270,13 +267,13 @@ def build_get_disable_soft_delete_requests_objects_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_delete_resource_guard_proxy_requests_objects_request( +def build_get_delete_resource_guard_proxy_requests_objects_request( # pylint: disable=name-too-long resource_group_name: str, resource_guards_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: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -303,13 +300,13 @@ def build_get_delete_resource_guard_proxy_requests_objects_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_backup_security_pin_requests_objects_request( +def build_get_backup_security_pin_requests_objects_request( # pylint: disable=name-too-long resource_group_name: str, resource_guards_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: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -336,13 +333,13 @@ def build_get_backup_security_pin_requests_objects_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_delete_protected_item_requests_objects_request( +def build_get_delete_protected_item_requests_objects_request( # pylint: disable=name-too-long resource_group_name: str, resource_guards_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: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -369,13 +366,13 @@ def build_get_delete_protected_item_requests_objects_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_update_protection_policy_requests_objects_request( +def build_get_update_protection_policy_requests_objects_request( # pylint: disable=name-too-long resource_group_name: str, resource_guards_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: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -402,13 +399,13 @@ def build_get_update_protection_policy_requests_objects_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_update_protected_item_requests_objects_request( +def build_get_update_protected_item_requests_objects_request( # pylint: disable=name-too-long resource_group_name: str, resource_guards_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: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -435,13 +432,13 @@ def build_get_update_protected_item_requests_objects_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_default_disable_soft_delete_requests_object_request( +def build_get_default_disable_soft_delete_requests_object_request( # pylint: disable=name-too-long resource_group_name: str, resource_guards_name: str, request_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: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -469,13 +466,13 @@ def build_get_default_disable_soft_delete_requests_object_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_default_delete_resource_guard_proxy_requests_object_request( +def build_get_default_delete_resource_guard_proxy_requests_object_request( # pylint: disable=name-too-long resource_group_name: str, resource_guards_name: str, request_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: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -503,13 +500,13 @@ def build_get_default_delete_resource_guard_proxy_requests_object_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_default_backup_security_pin_requests_object_request( +def build_get_default_backup_security_pin_requests_object_request( # pylint: disable=name-too-long resource_group_name: str, resource_guards_name: str, request_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: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -537,13 +534,13 @@ def build_get_default_backup_security_pin_requests_object_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_default_delete_protected_item_requests_object_request( +def build_get_default_delete_protected_item_requests_object_request( # pylint: disable=name-too-long resource_group_name: str, resource_guards_name: str, request_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: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -571,13 +568,13 @@ def build_get_default_delete_protected_item_requests_object_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_default_update_protection_policy_requests_object_request( +def build_get_default_update_protection_policy_requests_object_request( # pylint: disable=name-too-long resource_group_name: str, resource_guards_name: str, request_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: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -605,13 +602,13 @@ def build_get_default_update_protection_policy_requests_object_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_default_update_protected_item_requests_object_request( +def build_get_default_update_protected_item_requests_object_request( # pylint: disable=name-too-long resource_group_name: str, resource_guards_name: str, request_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: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -673,9 +670,7 @@ def get_resources_in_subscription(self, **kwargs: Any) -> Iterable["_models.Reso _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -727,8 +722,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -764,9 +760,7 @@ def get_resources_in_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -819,8 +813,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -935,9 +930,7 @@ def put( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.ResourceGuardResource] = kwargs.pop("cls", None) @@ -964,8 +957,9 @@ def put( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1016,9 +1010,7 @@ def get(self, resource_group_name: str, resource_guards_name: str, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ResourceGuardResource] = kwargs.pop("cls", None) request = build_get_request( @@ -1033,8 +1025,9 @@ def get(self, resource_group_name: str, resource_guards_name: str, **kwargs: Any request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1083,9 +1076,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -1100,8 +1091,9 @@ def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1222,9 +1214,7 @@ def patch( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.ResourceGuardResource] = kwargs.pop("cls", None) @@ -1251,8 +1241,9 @@ def patch( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1295,9 +1286,7 @@ def get_disable_soft_delete_requests_objects( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -1351,8 +1340,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1369,7 +1359,7 @@ def get_next(next_link=None): } @distributed_trace - def get_delete_resource_guard_proxy_requests_objects( + def get_delete_resource_guard_proxy_requests_objects( # pylint: disable=name-too-long self, resource_group_name: str, resource_guards_name: str, **kwargs: Any ) -> Iterable["_models.DppBaseResource"]: """Returns collection of operation request objects for a critical operation protected by the given @@ -1391,9 +1381,7 @@ def get_delete_resource_guard_proxy_requests_objects( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -1447,8 +1435,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1487,9 +1476,7 @@ def get_backup_security_pin_requests_objects( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -1543,8 +1530,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1561,7 +1549,7 @@ def get_next(next_link=None): } @distributed_trace - def get_delete_protected_item_requests_objects( + def get_delete_protected_item_requests_objects( # pylint: disable=name-too-long self, resource_group_name: str, resource_guards_name: str, **kwargs: Any ) -> Iterable["_models.DppBaseResource"]: """Returns collection of operation request objects for a critical operation protected by the given @@ -1583,9 +1571,7 @@ def get_delete_protected_item_requests_objects( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -1639,8 +1625,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1657,7 +1644,7 @@ def get_next(next_link=None): } @distributed_trace - def get_update_protection_policy_requests_objects( + def get_update_protection_policy_requests_objects( # pylint: disable=name-too-long self, resource_group_name: str, resource_guards_name: str, **kwargs: Any ) -> Iterable["_models.DppBaseResource"]: """Returns collection of operation request objects for a critical operation protected by the given @@ -1679,9 +1666,7 @@ def get_update_protection_policy_requests_objects( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -1735,8 +1720,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1753,7 +1739,7 @@ def get_next(next_link=None): } @distributed_trace - def get_update_protected_item_requests_objects( + def get_update_protected_item_requests_objects( # pylint: disable=name-too-long self, resource_group_name: str, resource_guards_name: str, **kwargs: Any ) -> Iterable["_models.DppBaseResource"]: """Returns collection of operation request objects for a critical operation protected by the given @@ -1775,9 +1761,7 @@ def get_update_protected_item_requests_objects( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -1831,8 +1815,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1849,7 +1834,7 @@ def get_next(next_link=None): } @distributed_trace - def get_default_disable_soft_delete_requests_object( + def get_default_disable_soft_delete_requests_object( # pylint: disable=name-too-long self, resource_group_name: str, resource_guards_name: str, request_name: str, **kwargs: Any ) -> _models.DppBaseResource: """Returns collection of operation request objects for a critical operation protected by the given @@ -1881,9 +1866,7 @@ def get_default_disable_soft_delete_requests_object( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) request = build_get_default_disable_soft_delete_requests_object_request( @@ -1899,8 +1882,9 @@ def get_default_disable_soft_delete_requests_object( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1921,7 +1905,7 @@ def get_default_disable_soft_delete_requests_object( } @distributed_trace - def get_default_delete_resource_guard_proxy_requests_object( + def get_default_delete_resource_guard_proxy_requests_object( # pylint: disable=name-too-long self, resource_group_name: str, resource_guards_name: str, request_name: str, **kwargs: Any ) -> _models.DppBaseResource: """Returns collection of operation request objects for a critical operation protected by the given @@ -1953,9 +1937,7 @@ def get_default_delete_resource_guard_proxy_requests_object( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) request = build_get_default_delete_resource_guard_proxy_requests_object_request( @@ -1971,8 +1953,9 @@ def get_default_delete_resource_guard_proxy_requests_object( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1993,7 +1976,7 @@ def get_default_delete_resource_guard_proxy_requests_object( } @distributed_trace - def get_default_backup_security_pin_requests_object( + def get_default_backup_security_pin_requests_object( # pylint: disable=name-too-long self, resource_group_name: str, resource_guards_name: str, request_name: str, **kwargs: Any ) -> _models.DppBaseResource: """Returns collection of operation request objects for a critical operation protected by the given @@ -2025,9 +2008,7 @@ def get_default_backup_security_pin_requests_object( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) request = build_get_default_backup_security_pin_requests_object_request( @@ -2043,8 +2024,9 @@ def get_default_backup_security_pin_requests_object( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2065,7 +2047,7 @@ def get_default_backup_security_pin_requests_object( } @distributed_trace - def get_default_delete_protected_item_requests_object( + def get_default_delete_protected_item_requests_object( # pylint: disable=name-too-long self, resource_group_name: str, resource_guards_name: str, request_name: str, **kwargs: Any ) -> _models.DppBaseResource: """Returns collection of operation request objects for a critical operation protected by the given @@ -2097,9 +2079,7 @@ def get_default_delete_protected_item_requests_object( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) request = build_get_default_delete_protected_item_requests_object_request( @@ -2115,8 +2095,9 @@ def get_default_delete_protected_item_requests_object( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2137,7 +2118,7 @@ def get_default_delete_protected_item_requests_object( } @distributed_trace - def get_default_update_protection_policy_requests_object( + def get_default_update_protection_policy_requests_object( # pylint: disable=name-too-long self, resource_group_name: str, resource_guards_name: str, request_name: str, **kwargs: Any ) -> _models.DppBaseResource: """Returns collection of operation request objects for a critical operation protected by the given @@ -2169,9 +2150,7 @@ def get_default_update_protection_policy_requests_object( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) request = build_get_default_update_protection_policy_requests_object_request( @@ -2187,8 +2166,9 @@ def get_default_update_protection_policy_requests_object( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2209,7 +2189,7 @@ def get_default_update_protection_policy_requests_object( } @distributed_trace - def get_default_update_protected_item_requests_object( + def get_default_update_protected_item_requests_object( # pylint: disable=name-too-long self, resource_group_name: str, resource_guards_name: str, request_name: str, **kwargs: Any ) -> _models.DppBaseResource: """Returns collection of operation request objects for a critical operation protected by the given @@ -2241,9 +2221,7 @@ def get_default_update_protected_item_requests_object( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) request = build_get_default_update_protected_item_requests_object_request( @@ -2259,8 +2237,9 @@ def get_default_update_protected_item_requests_object( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 c0cca8ba6077..17ed6bdbe64b 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_find_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -198,9 +193,7 @@ def find( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.AzureBackupFindRestorableTimeRangesResponseResource] = kwargs.pop("cls", None) @@ -228,8 +221,9 @@ def find( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_secondary_rps_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_secondary_rps_operations.py new file mode 100644 index 000000000000..0feba111f039 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_secondary_rps_operations.py @@ -0,0 +1,299 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_fetch_request( + resource_group_name: str, + location: str, + subscription_id: str, + *, + filter: Optional[str] = None, + skip_token: Optional[str] = None, + **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", "2023-04-01-preview")) + 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/locations/{location}/fetchSecondaryRecoveryPoints", + ) # 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 + ), + "location": _SERIALIZER.url("location", location, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "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) + + +class SecondaryRPsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.dataprotection.DataProtectionMgmtClient`'s + :attr:`secondary_rps` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + def fetch( + self, + resource_group_name: str, + location: str, + parameters: _models.FetchSecondaryRPsRequestParameters, + filter: Optional[str] = None, + skip_token: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Iterable["_models.AzureBackupRecoveryPointResource"]: + """Returns a list of Secondary Recovery Points for a DataSource in a vault, that can be used for + Cross Region Restore. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: Required. + :type location: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.FetchSecondaryRPsRequestParameters + :param filter: OData filter options. Default value is None. + :type filter: str + :param skip_token: skipToken Filter. Default value is None. + :type skip_token: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AzureBackupRecoveryPointResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.AzureBackupRecoveryPointResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def fetch( + self, + resource_group_name: str, + location: str, + parameters: IO, + filter: Optional[str] = None, + skip_token: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Iterable["_models.AzureBackupRecoveryPointResource"]: + """Returns a list of Secondary Recovery Points for a DataSource in a vault, that can be used for + Cross Region Restore. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: Required. + :type location: str + :param parameters: Request body for operation. Required. + :type parameters: IO + :param filter: OData filter options. Default value is None. + :type filter: str + :param skip_token: skipToken Filter. Default value is None. + :type skip_token: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AzureBackupRecoveryPointResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.AzureBackupRecoveryPointResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def fetch( + self, + resource_group_name: str, + location: str, + parameters: Union[_models.FetchSecondaryRPsRequestParameters, IO], + filter: Optional[str] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.AzureBackupRecoveryPointResource"]: + """Returns a list of Secondary Recovery Points for a DataSource in a vault, that can be used for + Cross Region Restore. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: Required. + :type location: str + :param parameters: Request body for operation. Is either a FetchSecondaryRPsRequestParameters + type or a IO type. Required. + :type parameters: ~azure.mgmt.dataprotection.models.FetchSecondaryRPsRequestParameters or IO + :param filter: OData filter options. Default value is None. + :type filter: str + :param skip_token: skipToken Filter. Default value is None. + :type skip_token: str + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AzureBackupRecoveryPointResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.AzureBackupRecoveryPointResource] + :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[_models.AzureBackupRecoveryPointResourceList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "FetchSecondaryRPsRequestParameters") + + def prepare_request(next_link=None): + if not next_link: + + request = build_fetch_request( + resource_group_name=resource_group_name, + location=location, + subscription_id=self._config.subscription_id, + filter=filter, + skip_token=skip_token, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.fetch.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + 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 + + def extract_data(pipeline_response): + deserialized = self._deserialize("AzureBackupRecoveryPointResourceList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + 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 [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + fetch.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/locations/{location}/fetchSecondaryRecoveryPoints" + } diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/check_backup_vaults_name_availability.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/check_backup_vaults_name_availability.py index 2f0518eaa747..5dd11d6c204e 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/check_backup_vaults_name_availability.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/check_backup_vaults_name_availability.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/VaultCRUD/CheckBackupVaultsNameAvailability.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/VaultCRUD/CheckBackupVaultsNameAvailability.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 12f99e0f59ec..9f72e7ae7c99 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/checkfeature_support.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/checkfeature_support.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/CheckfeatureSupport.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/CheckfeatureSupport.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/create_or_update_backup_policy.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/create_or_update_backup_policy.py index 5599e3b95e8a..84a28dba67da 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/create_or_update_backup_policy.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/create_or_update_backup_policy.py @@ -92,6 +92,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/PolicyCRUD/CreateOrUpdateBackupPolicy.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/PolicyCRUD/CreateOrUpdateBackupPolicy.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_backup_instance.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_backup_instance.py index 9a84f9203a69..38911ae16399 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_backup_instance.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_backup_instance.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/BackupInstanceOperations/DeleteBackupInstance.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/BackupInstanceOperations/DeleteBackupInstance.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_backup_policy.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_backup_policy.py index 91243b96f408..232e903cd71c 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_backup_policy.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_backup_policy.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/PolicyCRUD/DeleteBackupPolicy.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/PolicyCRUD/DeleteBackupPolicy.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_backup_vault.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_backup_vault.py index f6e9f845f510..1e6feb9bd104 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_backup_vault.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_backup_vault.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/VaultCRUD/DeleteBackupVault.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/VaultCRUD/DeleteBackupVault.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_resource_guard.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_resource_guard.py index d7cce2e2bc37..5077e151bf30 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_resource_guard.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_resource_guard.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/ResourceGuardCRUD/DeleteResourceGuard.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/ResourceGuardCRUD/DeleteResourceGuard.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_resource_guard_proxy.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_resource_guard_proxy.py new file mode 100644 index 000000000000..abeb28af551d --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_resource_guard_proxy.py @@ -0,0 +1,42 @@ +# 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 delete_resource_guard_proxy.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="5e13b949-1218-4d18-8b99-7e12155ec4f7", + ) + + response = client.dpp_resource_guard_proxy.delete( + resource_group_name="SampleResourceGroup", + vault_name="sampleVault", + resource_guard_proxy_name="swaggerExample", + ) + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/ResourceGuardProxyCRUD/DeleteResourceGuardProxy.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/fetch_cross_region_restore_job.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/fetch_cross_region_restore_job.py new file mode 100644 index 000000000000..5e4ece94ee54 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/fetch_cross_region_restore_job.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.dataprotection import DataProtectionMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python fetch_cross_region_restore_job.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.cross_region_restore_job.get( + resource_group_name="BugBash1", + location="west us", + parameters={ + "jobId": "3c60cb49-63e8-4b21-b9bd-26277b3fdfae", + "sourceBackupVaultId": "/subscriptions/62b829ee-7936-40c9-a1c9-47a93f9f3965/resourceGroups/BugBash1/providers/Microsoft.DataProtection/backupVaults/BugBashVaultForCCYv11", + "sourceRegion": "east us", + }, + ) + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/CrossRegionRestore/FetchCrossRegionRestoreJob.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/fetch_cross_region_restore_jobs.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/fetch_cross_region_restore_jobs.py new file mode 100644 index 000000000000..a6f55d179766 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/fetch_cross_region_restore_jobs.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.dataprotection import DataProtectionMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python fetch_cross_region_restore_jobs.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.cross_region_restore_jobs.list( + resource_group_name="BugBash1", + location="east us", + parameters={ + "sourceBackupVaultId": "/subscriptions/62b829ee-7936-40c9-a1c9-47a93f9f3965/resourceGroups/BugBash1/providers/Microsoft.DataProtection/backupVaults/BugBashVaultForCCYv11", + "sourceRegion": "east us", + }, + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/CrossRegionRestore/FetchCrossRegionRestoreJobs.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/fetch_secondary_rps.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/fetch_secondary_rps.py new file mode 100644 index 000000000000..a07bfafca68a --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/fetch_secondary_rps.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.dataprotection import DataProtectionMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python fetch_secondary_rps.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", + ) + + response = client.secondary_rps.fetch( + resource_group_name="000pikumar", + location="WestUS", + parameters={ + "sourceBackupInstanceId": "/subscriptions/04cf684a-d41f-4550-9f70-7708a3a2283b/resourceGroups/HelloTest/providers/Microsoft.DataProtection/backupVaults/HelloTestVault/backupInstances/653213d-c5b3-44f6-a0d9-db3c4f9d8e34", + "sourceRegion": "EastUS", + }, + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/CrossRegionRestore/FetchSecondaryRPs.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/find_restorable_time_ranges.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/find_restorable_time_ranges.py index d2170dc28d25..0563b8e55198 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/find_restorable_time_ranges.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/find_restorable_time_ranges.py @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/BackupInstanceOperations/FindRestorableTimeRanges.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/BackupInstanceOperations/FindRestorableTimeRanges.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_instance.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_instance.py index 1cf9e309eec7..82ef0bf6e237 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_instance.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_instance.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/BackupInstanceOperations/GetBackupInstance.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/BackupInstanceOperations/GetBackupInstance.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_instance_operation_result.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_instance_operation_result.py index 3803e69c2d09..ec1e8851c796 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_instance_operation_result.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_instance_operation_result.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/BackupInstanceOperations/GetBackupInstanceOperationResult.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/BackupInstanceOperations/GetBackupInstanceOperationResult.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_policy.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_policy.py index ff3de052ba14..722618362bfd 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_policy.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_policy.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/PolicyCRUD/GetBackupPolicy.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/PolicyCRUD/GetBackupPolicy.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vault.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vault.py index 40ab5b193cfd..21ab762810fd 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vault.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vault.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/VaultCRUD/GetBackupVault.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/VaultCRUD/GetBackupVault.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vault_with_msi.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vault_with_msi.py index 6ef34c599719..b6bdc60c2ab5 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vault_with_msi.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vault_with_msi.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/VaultCRUD/GetBackupVaultWithMSI.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/VaultCRUD/GetBackupVaultWithMSI.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vaults_in_resource_group.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vaults_in_resource_group.py index aafff102d7d3..37419030c5bd 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vaults_in_resource_group.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vaults_in_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/VaultCRUD/GetBackupVaultsInResourceGroup.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/VaultCRUD/GetBackupVaultsInResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vaults_in_subscription.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vaults_in_subscription.py index 18dc42a3354a..21b2a41a1d81 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vaults_in_subscription.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vaults_in_subscription.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/VaultCRUD/GetBackupVaultsInSubscription.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/VaultCRUD/GetBackupVaultsInSubscription.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_backup_security_pin_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_backup_security_pin_requests.py index 9ef616f43172..f32e4dc40e20 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_backup_security_pin_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_backup_security_pin_requests.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/ResourceGuardCRUD/GetDefaultBackupSecurityPINRequests.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/ResourceGuardCRUD/GetDefaultBackupSecurityPINRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_delete_protected_item_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_delete_protected_item_requests.py index bdea96983368..6a2b118f2600 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_delete_protected_item_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_delete_protected_item_requests.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/ResourceGuardCRUD/GetDefaultDeleteProtectedItemRequests.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/ResourceGuardCRUD/GetDefaultDeleteProtectedItemRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_delete_resource_guard_proxy_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_delete_resource_guard_proxy_requests.py index 048724f717c4..2ba1dea456d3 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_delete_resource_guard_proxy_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_delete_resource_guard_proxy_requests.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/ResourceGuardCRUD/GetDefaultDeleteResourceGuardProxyRequests.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/ResourceGuardCRUD/GetDefaultDeleteResourceGuardProxyRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_disable_soft_delete_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_disable_soft_delete_requests.py index c48ed83ef6d8..192e981ef857 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_disable_soft_delete_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_disable_soft_delete_requests.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/ResourceGuardCRUD/GetDefaultDisableSoftDeleteRequests.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/ResourceGuardCRUD/GetDefaultDisableSoftDeleteRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_update_protected_item_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_update_protected_item_requests.py index 75164aa33e4e..9b6b7d4f6fe9 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_update_protected_item_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_update_protected_item_requests.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/ResourceGuardCRUD/GetDefaultUpdateProtectedItemRequests.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/ResourceGuardCRUD/GetDefaultUpdateProtectedItemRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_update_protection_policy_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_update_protection_policy_requests.py index 7509403597ac..9d0214f46cc3 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_update_protection_policy_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_update_protection_policy_requests.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/ResourceGuardCRUD/GetDefaultUpdateProtectionPolicyRequests.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/ResourceGuardCRUD/GetDefaultUpdateProtectionPolicyRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_deleted_backup_instance.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_deleted_backup_instance.py index 85dc5180a54a..1450d1f7ccd4 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_deleted_backup_instance.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_deleted_backup_instance.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/DeletedBackupInstanceOperations/GetDeletedBackupInstance.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/DeletedBackupInstanceOperations/GetDeletedBackupInstance.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_export_jobs_operation_result.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_export_jobs_operation_result.py index a60bf7071971..f68c8ecc2dd1 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_export_jobs_operation_result.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_export_jobs_operation_result.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/JobCRUD/GetExportJobsOperationResult.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/JobCRUD/GetExportJobsOperationResult.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_job.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_job.py index f92e2e493a69..80019235f85c 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_job.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_job.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/JobCRUD/GetJob.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/JobCRUD/GetJob.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 5ba961f82086..dd4fd4134708 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 @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/GetOperationResult.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/GetOperationResult.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_result_patch.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_result_patch.py index dbabe2412825..812ef8e0890c 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_result_patch.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_result_patch.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/VaultCRUD/GetOperationResultPatch.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/VaultCRUD/GetOperationResultPatch.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 a63fcacf252d..c6988bf31d55 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 @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/GetOperationStatus.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/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 21ed213bd15f..ed11219f0c99 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 @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/GetOperationStatusRGContext.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/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 869cf99d2a0b..84c59858e0f8 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/GetOperationStatusVaultContext.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/GetOperationStatusVaultContext.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_recovery_point.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_recovery_point.py index 8c9f93b232c1..d33ec20f350e 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_recovery_point.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_recovery_point.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/BackupInstanceOperations/GetRecoveryPoint.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/BackupInstanceOperations/GetRecoveryPoint.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_resource_guard.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_resource_guard.py index eeab967f164a..7376083706a8 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_resource_guard.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_resource_guard.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/ResourceGuardCRUD/GetResourceGuard.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/ResourceGuardCRUD/GetResourceGuard.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_resource_guard_proxy.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_resource_guard_proxy.py new file mode 100644 index 000000000000..a2f713a725c0 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_resource_guard_proxy.py @@ -0,0 +1,42 @@ +# 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_resource_guard_proxy.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="5e13b949-1218-4d18-8b99-7e12155ec4f7", + ) + + response = client.dpp_resource_guard_proxy.get( + resource_group_name="SampleResourceGroup", + vault_name="sampleVault", + resource_guard_proxy_name="swaggerExample", + ) + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/ResourceGuardProxyCRUD/GetResourceGuardProxy.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_resource_guards_in_resource_group.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_resource_guards_in_resource_group.py index 4d8bc7672259..ba2a4de1942a 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_resource_guards_in_resource_group.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_resource_guards_in_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/ResourceGuardCRUD/GetResourceGuardsInResourceGroup.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/ResourceGuardCRUD/GetResourceGuardsInResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_resource_guards_in_subscription.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_resource_guards_in_subscription.py index dad6a72c0394..f42621f3f5da 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_resource_guards_in_subscription.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_resource_guards_in_subscription.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/ResourceGuardCRUD/GetResourceGuardsInSubscription.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/ResourceGuardCRUD/GetResourceGuardsInSubscription.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list.py index be4e658e5cb4..1308ec6dcd47 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/Operations/List.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/Operations/List.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_backup_instances.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_backup_instances.py index 0cb064ea8752..7001b082af0b 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_backup_instances.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_backup_instances.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/BackupInstanceOperations/ListBackupInstances.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/BackupInstanceOperations/ListBackupInstances.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_backup_instances_extension_routing.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_backup_instances_extension_routing.py new file mode 100644 index 000000000000..5f377ceb2cfd --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_backup_instances_extension_routing.py @@ -0,0 +1,41 @@ +# 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 list_backup_instances_extension_routing.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="SUBSCRIPTION_ID", + ) + + response = client.backup_instances_extension_routing.list( + resource_id="subscriptions/36d32b25-3dc7-41b0-bde1-397500644591/resourceGroups/testRG/providers/Microsoft.Compute/disks/testDisk", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/BackupInstanceOperations/ListBackupInstancesExtensionRouting.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_backup_policy.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_backup_policy.py index 9787090445b1..9c697fed3abf 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_backup_policy.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_backup_policy.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/PolicyCRUD/ListBackupPolicy.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/PolicyCRUD/ListBackupPolicy.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_backup_security_pin_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_backup_security_pin_requests.py index 989a036708e3..6962b2a078fa 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_backup_security_pin_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_backup_security_pin_requests.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/ResourceGuardCRUD/ListBackupSecurityPINRequests.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/ResourceGuardCRUD/ListBackupSecurityPINRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_delete_protected_item_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_delete_protected_item_requests.py index 76c3c90d301d..1e50b01f1d2c 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_delete_protected_item_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_delete_protected_item_requests.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/ResourceGuardCRUD/ListDeleteProtectedItemRequests.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/ResourceGuardCRUD/ListDeleteProtectedItemRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_delete_resource_guard_proxy_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_delete_resource_guard_proxy_requests.py index 875d69fc77b1..879d945b7dab 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_delete_resource_guard_proxy_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_delete_resource_guard_proxy_requests.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/ResourceGuardCRUD/ListDeleteResourceGuardProxyRequests.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/ResourceGuardCRUD/ListDeleteResourceGuardProxyRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_deleted_backup_instances.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_deleted_backup_instances.py index 691976969356..3b5bf1e65bb5 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_deleted_backup_instances.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_deleted_backup_instances.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/DeletedBackupInstanceOperations/ListDeletedBackupInstances.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/DeletedBackupInstanceOperations/ListDeletedBackupInstances.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_disable_soft_delete_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_disable_soft_delete_requests.py index 172ef1e1677f..0ab3147eae79 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_disable_soft_delete_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_disable_soft_delete_requests.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/ResourceGuardCRUD/ListDisableSoftDeleteRequests.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/ResourceGuardCRUD/ListDisableSoftDeleteRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_jobs.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_jobs.py index 8468d25256ec..554a43f54262 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_jobs.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_jobs.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/JobCRUD/ListJobs.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/JobCRUD/ListJobs.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_recovery_points.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_recovery_points.py index ccf70f19b7aa..4a00e586d748 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_recovery_points.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_recovery_points.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/BackupInstanceOperations/ListRecoveryPoints.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/BackupInstanceOperations/ListRecoveryPoints.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_resource_guard_proxy.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_resource_guard_proxy.py new file mode 100644 index 000000000000..116952464a2f --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_resource_guard_proxy.py @@ -0,0 +1,42 @@ +# 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 list_resource_guard_proxy.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="5e13b949-1218-4d18-8b99-7e12155ec4f7", + ) + + response = client.dpp_resource_guard_proxy.list( + resource_group_name="SampleResourceGroup", + vault_name="sampleVault", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/ResourceGuardProxyCRUD/ListResourceGuardProxy.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_update_protected_item_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_update_protected_item_requests.py index 26727b9ee3c2..f3e4d87a2cfc 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_update_protected_item_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_update_protected_item_requests.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/ResourceGuardCRUD/ListUpdateProtectedItemRequests.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/ResourceGuardCRUD/ListUpdateProtectedItemRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_update_protection_policy_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_update_protection_policy_requests.py index 1824db65e475..d11d2e3d447d 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_update_protection_policy_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_update_protection_policy_requests.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/ResourceGuardCRUD/ListUpdateProtectionPolicyRequests.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/ResourceGuardCRUD/ListUpdateProtectionPolicyRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/patch_backup_vault.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/patch_backup_vault.py index 9e124e202f75..7231d97114a6 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/patch_backup_vault.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/patch_backup_vault.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/VaultCRUD/PatchBackupVault.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/VaultCRUD/PatchBackupVault.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/patch_resource_guard.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/patch_resource_guard.py index e43cfa62e5c3..6210d2cb7cf5 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/patch_resource_guard.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/patch_resource_guard.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/ResourceGuardCRUD/PatchResourceGuard.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/ResourceGuardCRUD/PatchResourceGuard.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_backup_instance.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_backup_instance.py index 9024ef37b192..4734c8f89ffc 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_backup_instance.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_backup_instance.py @@ -82,6 +82,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/BackupInstanceOperations/PutBackupInstance.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/BackupInstanceOperations/PutBackupInstance.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_backup_vault.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_backup_vault.py index 0d3fde6f43ea..40a79e6e407c 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_backup_vault.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_backup_vault.py @@ -36,7 +36,9 @@ def main(): "identity": {"type": "None"}, "location": "WestUS", "properties": { + "featureSettings": {"crossRegionRestoreSettings": {"state": "Enabled"}}, "monitoringSettings": {"azureMonitorAlertSettings": {"alertsForAllJobFailures": "Enabled"}}, + "securitySettings": {"softDeleteSettings": {"retentionDurationInDays": 14, "state": "Enabled"}}, "storageSettings": [{"datastoreType": "VaultStore", "type": "LocallyRedundant"}], }, "tags": {"key1": "val1"}, @@ -45,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/VaultCRUD/PutBackupVault.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/VaultCRUD/PutBackupVault.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_backup_vault_with_msi.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_backup_vault_with_msi.py index 12c0798d5a7d..b60985419c1d 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_backup_vault_with_msi.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_backup_vault_with_msi.py @@ -36,7 +36,9 @@ def main(): "identity": {"type": "systemAssigned"}, "location": "WestUS", "properties": { + "featureSettings": {"crossRegionRestoreSettings": {"state": "Enabled"}}, "monitoringSettings": {"azureMonitorAlertSettings": {"alertsForAllJobFailures": "Enabled"}}, + "securitySettings": {"softDeleteSettings": {"retentionDurationInDays": 14, "state": "Enabled"}}, "storageSettings": [{"datastoreType": "VaultStore", "type": "LocallyRedundant"}], }, "tags": {"key1": "val1"}, @@ -45,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/VaultCRUD/PutBackupVaultWithMSI.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/VaultCRUD/PutBackupVaultWithMSI.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_resource_guard.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_resource_guard.py index e5f511c32004..591363965797 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_resource_guard.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_resource_guard.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/ResourceGuardCRUD/PutResourceGuard.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/ResourceGuardCRUD/PutResourceGuard.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_resource_guard_proxy.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_resource_guard_proxy.py new file mode 100644 index 000000000000..adcb51b5439c --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_resource_guard_proxy.py @@ -0,0 +1,47 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.dataprotection import DataProtectionMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python put_resource_guard_proxy.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="5e13b949-1218-4d18-8b99-7e12155ec4f7", + ) + + response = client.dpp_resource_guard_proxy.create_or_update( + resource_group_name="SampleResourceGroup", + vault_name="sampleVault", + resource_guard_proxy_name="swaggerExample", + parameters={ + "properties": { + "resourceGuardResourceId": "/subscriptions/f9e67185-f313-4e79-aa71-6458d429369d/resourceGroups/ResourceGuardSecurityAdminRG/providers/Microsoft.DataProtection/resourceGuards/ResourceGuardTestResource" + } + }, + ) + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/ResourceGuardProxyCRUD/PutResourceGuardProxy.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resume_backups.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resume_backups.py index 8add7547813a..8fb43da983ce 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resume_backups.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resume_backups.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/BackupInstanceOperations/ResumeBackups.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/BackupInstanceOperations/ResumeBackups.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resume_protection.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resume_protection.py index 430e15a58c44..56b523daa11b 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resume_protection.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resume_protection.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/BackupInstanceOperations/ResumeProtection.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/BackupInstanceOperations/ResumeProtection.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/stop_protection.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/stop_protection.py index 5de598e3fc59..b2ebce897d67 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/stop_protection.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/stop_protection.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/BackupInstanceOperations/StopProtection.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/BackupInstanceOperations/StopProtection.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/suspend_backups.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/suspend_backups.py index 9cbd6566427d..b8d3ded2aafa 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/suspend_backups.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/suspend_backups.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/BackupInstanceOperations/SuspendBackups.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/BackupInstanceOperations/SuspendBackups.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/sync_backup_instance.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/sync_backup_instance.py index 0c72da54d75f..86ddf69549cc 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/sync_backup_instance.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/sync_backup_instance.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/BackupInstanceOperations/SyncBackupInstance.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/BackupInstanceOperations/SyncBackupInstance.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_backup.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_backup.py index 9eb9254593fd..201695660c09 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_backup.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_backup.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/BackupInstanceOperations/TriggerBackup.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/BackupInstanceOperations/TriggerBackup.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_cross_region_restore.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_cross_region_restore.py new file mode 100644 index 000000000000..0292441bbc1f --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_cross_region_restore.py @@ -0,0 +1,83 @@ +# 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 trigger_cross_region_restore.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", + ) + + response = client.backup_instances.begin_trigger_cross_region_restore( + resource_group_name="000pikumar", + location="EastAsia", + parameters={ + "crossRegionRestoreDetails": { + "sourceBackupInstanceId": "/subscriptions/04cf684a-d41f-4550-9f70-7708a3a2283b/resourceGroups/000pikumar/providers/Microsoft.DataProtection/backupVaults/PratikPrivatePreviewVault1/BackupInstances/harshitbi1", + "sourceRegion": "east asia", + }, + "restoreRequestObject": { + "objectType": "AzureBackupRecoveryPointBasedRestoreRequest", + "recoveryPointId": "hardcodedRP", + "restoreTargetInfo": { + "datasourceAuthCredentials": { + "objectType": "SecretStoreBasedAuthCredentials", + "secretStoreResource": { + "secretStoreType": "AzureKeyVault", + "uri": "https://samplevault.vault.azure.net/secrets/credentials", + }, + }, + "datasourceInfo": { + "datasourceType": "Microsoft.DBforPostgreSQL/servers/databases", + "objectType": "Datasource", + "resourceID": "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest/databases/targetdb", + "resourceLocation": "", + "resourceName": "targetdb", + "resourceType": "Microsoft.DBforPostgreSQL/servers/databases", + "resourceUri": "", + }, + "datasourceSetInfo": { + "datasourceType": "Microsoft.DBforPostgreSQL/servers/databases", + "objectType": "DatasourceSet", + "resourceID": "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest", + "resourceLocation": "", + "resourceName": "viveksipgtest", + "resourceType": "Microsoft.DBforPostgreSQL/servers", + "resourceUri": "", + }, + "objectType": "RestoreTargetInfo", + "recoveryOption": "FailIfExists", + "restoreLocation": "southeastasia", + }, + "sourceDataStoreType": "VaultStore", + "sourceResourceId": "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest/databases/testdb", + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/CrossRegionRestore/TriggerCrossRegionRestore.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_export_jobs.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_export_jobs.py index 4a5687899444..ced6bd405659 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_export_jobs.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_export_jobs.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/JobCRUD/TriggerExportJobs.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/JobCRUD/TriggerExportJobs.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_rehydrate.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_rehydrate.py index 663efe90445c..7f80ff25ac37 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_rehydrate.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_rehydrate.py @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/BackupInstanceOperations/TriggerRehydrate.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/BackupInstanceOperations/TriggerRehydrate.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_restore.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_restore.py index 0bb40d5058ed..ba0e3decbf42 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_restore.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_restore.py @@ -73,6 +73,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/BackupInstanceOperations/TriggerRestore.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/BackupInstanceOperations/TriggerRestore.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_restore_as_files.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_restore_as_files.py index de3a93cb35ea..94a27bdd3d56 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_restore_as_files.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_restore_as_files.py @@ -53,6 +53,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/BackupInstanceOperations/TriggerRestoreAsFiles.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/BackupInstanceOperations/TriggerRestoreAsFiles.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_restore_with_rehydration.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_restore_with_rehydration.py index 77063609e51e..be8d9e2f7134 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_restore_with_rehydration.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_restore_with_rehydration.py @@ -68,6 +68,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/BackupInstanceOperations/TriggerRestoreWithRehydration.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/BackupInstanceOperations/TriggerRestoreWithRehydration.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/undelete_deleted_backup_instance.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/undelete_deleted_backup_instance.py index 08f085695414..88e2b27ecc74 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/undelete_deleted_backup_instance.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/undelete_deleted_backup_instance.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/DeletedBackupInstanceOperations/UndeleteDeletedBackupInstance.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/DeletedBackupInstanceOperations/UndeleteDeletedBackupInstance.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/unlock_delete_resource_guard_proxy.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/unlock_delete_resource_guard_proxy.py new file mode 100644 index 000000000000..03739d472d26 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/unlock_delete_resource_guard_proxy.py @@ -0,0 +1,48 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.dataprotection import DataProtectionMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python unlock_delete_resource_guard_proxy.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="5e13b949-1218-4d18-8b99-7e12155ec4f7", + ) + + response = client.dpp_resource_guard_proxy.unlock_delete( + resource_group_name="SampleResourceGroup", + vault_name="sampleVault", + resource_guard_proxy_name="swaggerExample", + parameters={ + "resourceGuardOperationRequests": [ + "/subscriptions/f9e67185-f313-4e79-aa71-6458d429369d/resourceGroups/ResourceGuardSecurityAdminRG/providers/Microsoft.DataProtection/resourceGuards/ResourceGuardTestResource/deleteBackupInstanceRequests/default" + ], + "resourceToBeDeleted": "/subscriptions/5e13b949-1218-4d18-8b99-7e12155ec4f7/resourceGroups/SampleResourceGroup/providers/Microsoft.DataProtection/backupVaults/sampleVault/backupInstances/TestBI9779f4de", + }, + ) + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/ResourceGuardProxyCRUD/UnlockDeleteResourceGuardProxy.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/validate_cross_region_restore.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/validate_cross_region_restore.py new file mode 100644 index 000000000000..96ee1361b949 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/validate_cross_region_restore.py @@ -0,0 +1,83 @@ +# 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_cross_region_restore.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", + ) + + response = client.backup_instances.begin_validate_cross_region_restore( + resource_group_name="000pikumar", + location="EastAsia", + parameters={ + "crossRegionRestoreDetails": { + "sourceBackupInstanceId": "/subscriptions/04cf684a-d41f-4550-9f70-7708a3a2283b/resourceGroups/000pikumar/providers/Microsoft.DataProtection/backupVaults/PratikPrivatePreviewVault1/BackupInstances/harshitbi1", + "sourceRegion": "east asia", + }, + "restoreRequestObject": { + "objectType": "AzureBackupRecoveryPointBasedRestoreRequest", + "recoveryPointId": "hardcodedRP", + "restoreTargetInfo": { + "datasourceAuthCredentials": { + "objectType": "SecretStoreBasedAuthCredentials", + "secretStoreResource": { + "secretStoreType": "AzureKeyVault", + "uri": "https://samplevault.vault.azure.net/secrets/credentials", + }, + }, + "datasourceInfo": { + "datasourceType": "Microsoft.DBforPostgreSQL/servers/databases", + "objectType": "Datasource", + "resourceID": "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest/databases/targetdb", + "resourceLocation": "", + "resourceName": "targetdb", + "resourceType": "Microsoft.DBforPostgreSQL/servers/databases", + "resourceUri": "", + }, + "datasourceSetInfo": { + "datasourceType": "Microsoft.DBforPostgreSQL/servers/databases", + "objectType": "DatasourceSet", + "resourceID": "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest", + "resourceLocation": "", + "resourceName": "viveksipgtest", + "resourceType": "Microsoft.DBforPostgreSQL/servers", + "resourceUri": "", + }, + "objectType": "RestoreTargetInfo", + "recoveryOption": "FailIfExists", + "restoreLocation": "southeastasia", + }, + "sourceDataStoreType": "VaultStore", + "sourceResourceId": "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest/databases/testdb", + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/CrossRegionRestore/ValidateCrossRegionRestore.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/validate_for_backup.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/validate_for_backup.py index 8da385ced1be..25ae02d90264 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/validate_for_backup.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/validate_for_backup.py @@ -70,6 +70,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/BackupInstanceOperations/ValidateForBackup.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/BackupInstanceOperations/ValidateForBackup.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/validate_restore.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/validate_restore.py index 9b97a3004aa8..6c661f55af2e 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/validate_restore.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/validate_restore.py @@ -75,6 +75,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/BackupInstanceOperations/ValidateRestore.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-04-01-preview/examples/BackupInstanceOperations/ValidateRestore.json if __name__ == "__main__": main()