From 280377a5c2a2dd0118fd91922e1b5c9f9e1fb583 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 28 Aug 2023 11:40:30 +0000 Subject: [PATCH] CodeGen from PR 25264 in Azure/azure-rest-api-specs Merge 0b3bf4bf70cdab8a267e52e9134811b206a1ab25 into 0c4762d037f0d00d4e384add4e3d7200a2993b2c --- .../azure-mgmt-dataprotection/_meta.json | 10 +- .../mgmt/dataprotection/_configuration.py | 6 +- .../_data_protection_mgmt_client.py | 29 +- .../mgmt/dataprotection/_serialization.py | 26 +- .../azure/mgmt/dataprotection/_vendor.py | 14 - .../azure/mgmt/dataprotection/_version.py | 2 +- .../mgmt/dataprotection/aio/_configuration.py | 6 +- .../aio/_data_protection_mgmt_client.py | 29 +- .../dataprotection/aio/operations/__init__.py | 8 + ..._instances_extension_routing_operations.py | 138 ++++ .../_backup_instances_operations.py | 491 +++++++++++++- .../_cross_region_restore_job_operations.py | 194 ++++++ .../_cross_region_restore_jobs_operations.py | 228 +++++++ .../aio/operations/_jobs_operations.py | 203 +++++- .../operations/_secondary_rps_operations.py | 251 +++++++ .../mgmt/dataprotection/models/__init__.py | 22 + .../_data_protection_mgmt_client_enums.py | 6 + .../mgmt/dataprotection/models/_models_py3.py | 361 +++++++++- .../dataprotection/operations/__init__.py | 8 + ..._instances_extension_routing_operations.py | 164 +++++ .../_backup_instances_operations.py | 623 +++++++++++++++++- .../operations/_backup_policies_operations.py | 18 +- ...ckup_vault_operation_results_operations.py | 6 +- .../operations/_backup_vaults_operations.py | 30 +- .../_cross_region_restore_job_operations.py | 231 +++++++ .../_cross_region_restore_jobs_operations.py | 262 ++++++++ .../operations/_data_protection_operations.py | 6 +- .../_data_protection_operations_operations.py | 2 +- .../_deleted_backup_instances_operations.py | 14 +- .../_dpp_resource_guard_proxy_operations.py | 22 +- ...export_jobs_operation_result_operations.py | 6 +- .../operations/_export_jobs_operations.py | 6 +- .../operations/_jobs_operations.py | 274 +++++++- .../_operation_result_operations.py | 6 +- ..._status_backup_vault_context_operations.py | 6 +- .../_operation_status_operations.py | 6 +- ...tatus_resource_group_context_operations.py | 6 +- .../operations/_recovery_points_operations.py | 10 +- .../operations/_resource_guards_operations.py | 74 +-- .../_restorable_time_ranges_operations.py | 6 +- .../operations/_secondary_rps_operations.py | 300 +++++++++ .../delete_backup_instance.py | 2 +- .../find_restorable_time_ranges.py | 2 +- .../get_backup_instance.py | 2 +- .../get_backup_instance_operation_result.py | 2 +- .../get_recovery_point.py | 2 +- .../list_backup_instances.py | 2 +- ...list_backup_instances_extension_routing.py | 41 ++ .../list_recovery_points.py | 2 +- .../put_backup_instance.py | 2 +- .../resume_backups.py | 2 +- .../resume_protection.py | 2 +- .../stop_protection.py | 2 +- .../suspend_backups.py | 2 +- .../sync_backup_instance.py | 2 +- .../trigger_backup.py | 2 +- .../trigger_rehydrate.py | 2 +- .../trigger_restore.py | 2 +- .../trigger_restore_as_files.py | 2 +- .../trigger_restore_with_rehydration.py | 2 +- .../validate_for_backup.py | 2 +- .../validate_restore.py | 2 +- .../generated_samples/checkfeature_support.py | 2 +- .../fetch_cross_region_restore_job.py | 46 ++ .../fetch_cross_region_restore_jobs.py | 46 ++ .../fetch_secondary_rps.py | 46 ++ .../trigger_cross_region_restore.py | 83 +++ .../validate_cross_region_restore.py | 83 +++ .../get_deleted_backup_instance.py | 2 +- .../list_deleted_backup_instances.py | 2 +- .../undelete_deleted_backup_instance.py | 2 +- .../generated_samples/get_operation_result.py | 2 +- .../generated_samples/get_operation_status.py | 2 +- .../get_operation_status_rg_context.py | 2 +- .../get_operation_status_vault_context.py | 2 +- .../job_crud/generate_progress_url.py | 42 ++ .../get_export_jobs_operation_result.py | 2 +- .../generated_samples/job_crud/get_job.py | 2 +- .../generated_samples/job_crud/list_jobs.py | 2 +- .../job_crud/trigger_cancel.py | 41 ++ .../job_crud/trigger_export_jobs.py | 2 +- .../generated_samples/operations/list.py | 2 +- .../create_or_update_backup_policy.py | 2 +- .../policy_crud/delete_backup_policy.py | 2 +- .../policy_crud/get_backup_policy.py | 2 +- .../policy_crud/list_backup_policy.py | 2 +- .../delete_resource_guard.py | 2 +- ...et_default_backup_security_pin_requests.py | 2 +- ..._default_delete_protected_item_requests.py | 2 +- ...lt_delete_resource_guard_proxy_requests.py | 2 +- ...et_default_disable_soft_delete_requests.py | 2 +- ..._default_update_protected_item_requests.py | 2 +- ...fault_update_protection_policy_requests.py | 2 +- .../resource_guard_crud/get_resource_guard.py | 2 +- .../get_resource_guards_in_resource_group.py | 2 +- .../get_resource_guards_in_subscription.py | 2 +- .../list_backup_security_pin_requests.py | 2 +- .../list_delete_protected_item_requests.py | 2 +- ...st_delete_resource_guard_proxy_requests.py | 2 +- .../list_disable_soft_delete_requests.py | 2 +- .../list_update_protected_item_requests.py | 2 +- .../list_update_protection_policy_requests.py | 2 +- .../patch_resource_guard.py | 2 +- .../resource_guard_crud/put_resource_guard.py | 2 +- .../delete_resource_guard_proxy.py | 2 +- .../get_resource_guard_proxy.py | 2 +- .../list_resource_guard_proxy.py | 2 +- .../put_resource_guard_proxy.py | 2 +- .../unlock_delete_resource_guard_proxy.py | 2 +- .../check_backup_vaults_name_availability.py | 2 +- .../vault_crud/delete_backup_vault.py | 2 +- .../vault_crud/get_backup_vault.py | 2 +- .../vault_crud/get_backup_vault_with_msi.py | 2 +- .../get_backup_vaults_in_resource_group.py | 2 +- .../get_backup_vaults_in_subscription.py | 2 +- .../vault_crud/get_operation_result_patch.py | 2 +- .../vault_crud/patch_backup_vault.py | 2 +- .../vault_crud/put_backup_vault.py | 2 +- .../vault_crud/put_backup_vault_with_msi.py | 2 +- 119 files changed, 4410 insertions(+), 268 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/_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/_secondary_rps_operations.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/list_backup_instances_extension_routing.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/cross_region_restore/fetch_cross_region_restore_job.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/cross_region_restore/fetch_cross_region_restore_jobs.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/cross_region_restore/fetch_secondary_rps.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/cross_region_restore/trigger_cross_region_restore.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/cross_region_restore/validate_cross_region_restore.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/job_crud/generate_progress_url.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/job_crud/trigger_cancel.py diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/_meta.json b/sdk/dataprotection/azure-mgmt-dataprotection/_meta.json index b1f1b7dfd925..666c0402986e 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/_meta.json +++ b/sdk/dataprotection/azure-mgmt-dataprotection/_meta.json @@ -1,11 +1,11 @@ { - "commit": "a8fb6bcb9872431012ed1c7edbb7f369295422a5", + "commit": "959d6c1fcf6cb85dfe6ecfa9a692b4d715715f6f", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.2", + "autorest": "3.9.7", "use": [ - "@autorest/python@6.6.0", - "@autorest/modelerfour@4.24.3" + "@autorest/python@6.7.1", + "@autorest/modelerfour@4.26.2" ], - "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.6.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.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --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 74d9acfeec0c..8579e628f50d 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_configuration.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_configuration.py @@ -29,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-05-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-06-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: str = kwargs.pop("api_version", "2023-05-01") + api_version: str = kwargs.pop("api_version", "2023-06-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 a00da08653ec..b58219dc1686 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,10 +16,13 @@ from ._configuration import DataProtectionMgmtClientConfiguration from ._serialization import Deserializer, Serializer from .operations import ( + BackupInstancesExtensionRoutingOperations, BackupInstancesOperations, BackupPoliciesOperations, BackupVaultOperationResultsOperations, BackupVaultsOperations, + CrossRegionRestoreJobOperations, + CrossRegionRestoreJobsOperations, DataProtectionOperations, DataProtectionOperationsOperations, DeletedBackupInstancesOperations, @@ -34,6 +37,7 @@ RecoveryPointsOperations, ResourceGuardsOperations, RestorableTimeRangesOperations, + SecondaryRPsOperations, ) if TYPE_CHECKING: @@ -72,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 @@ -96,8 +111,8 @@ class DataProtectionMgmtClient: # pylint: disable=client-accepts-api-version-ke :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2023-05-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-06-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. @@ -144,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 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 842ae727fbbc..4bae2292227b 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_serialization.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_serialization.py @@ -662,8 +662,9 @@ def _serialize(self, target_obj, data_type=None, **kwargs): _serialized.update(_new_attr) # type: ignore _new_attr = _new_attr[k] # type: ignore _serialized = _serialized[k] - except ValueError: - continue + except ValueError as err: + if isinstance(err, SerializationError): + raise except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) @@ -741,6 +742,8 @@ def query(self, name, data, data_type, **kwargs): :param data: The data to be serialized. :param str data_type: The type to be serialized from. + :keyword bool skip_quote: Whether to skip quote the serialized result. + Defaults to False. :rtype: str :raises: TypeError if serialization fails. :raises: ValueError if data is None @@ -749,10 +752,8 @@ def query(self, name, data, data_type, **kwargs): # Treat the list aside, since we don't want to encode the div separator if data_type.startswith("["): internal_data_type = data_type[1:-1] - data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data] - if not kwargs.get("skip_quote", False): - data = [quote(str(d), safe="") for d in data] - return str(self.serialize_iter(data, internal_data_type, **kwargs)) + do_quote = not kwargs.get("skip_quote", False) + return str(self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs)) # Not a list, regular serialization output = self.serialize_data(data, data_type, **kwargs) @@ -891,6 +892,8 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): not be None or empty. :param str div: If set, this str will be used to combine the elements in the iterable into a combined string. Default is 'None'. + :keyword bool do_quote: Whether to quote the serialized result of each iterable element. + Defaults to False. :rtype: list, str """ if isinstance(data, str): @@ -903,9 +906,14 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): for d in data: try: serialized.append(self.serialize_data(d, iter_type, **kwargs)) - except ValueError: + except ValueError as err: + if isinstance(err, SerializationError): + raise serialized.append(None) + if kwargs.get("do_quote", False): + serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] + if div: serialized = ["" if s is None else str(s) for s in serialized] serialized = div.join(serialized) @@ -950,7 +958,9 @@ def serialize_dict(self, attr, dict_type, **kwargs): for key, value in attr.items(): try: serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) - except ValueError: + except ValueError as err: + if isinstance(err, SerializationError): + raise serialized[self.serialize_unicode(key)] = None if "xml" in serialization_ctxt: diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_vendor.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_vendor.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): if files: request.set_formdata_body(files) return request - - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], template.split("/")) - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) 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 dbf4c577231c..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.2.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 763194804c29..a0e4c324e9db 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 @@ -29,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-05-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-06-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: str = kwargs.pop("api_version", "2023-05-01") + api_version: str = kwargs.pop("api_version", "2023-06-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 6b3517b1e691..95d2b66e47b5 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,10 +16,13 @@ from .._serialization import Deserializer, Serializer from ._configuration import DataProtectionMgmtClientConfiguration from .operations import ( + BackupInstancesExtensionRoutingOperations, BackupInstancesOperations, BackupPoliciesOperations, BackupVaultOperationResultsOperations, BackupVaultsOperations, + CrossRegionRestoreJobOperations, + CrossRegionRestoreJobsOperations, DataProtectionOperations, DataProtectionOperationsOperations, DeletedBackupInstancesOperations, @@ -34,6 +37,7 @@ RecoveryPointsOperations, ResourceGuardsOperations, RestorableTimeRangesOperations, + SecondaryRPsOperations, ) if TYPE_CHECKING: @@ -72,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 @@ -96,8 +111,8 @@ class DataProtectionMgmtClient: # pylint: disable=client-accepts-api-version-ke :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2023-05-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-06-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. @@ -144,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 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 0bf84afef994..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,6 +17,10 @@ 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 @@ -41,6 +45,10 @@ "BackupPoliciesOperations", "BackupInstancesOperations", "RecoveryPointsOperations", + "SecondaryRPsOperations", + "CrossRegionRestoreJobOperations", + "CrossRegionRestoreJobsOperations", + "BackupInstancesExtensionRoutingOperations", "JobsOperations", "RestorableTimeRangesOperations", "ExportJobsOperations", 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 1709d14138a5..eaef1e2ab743 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 @@ -43,8 +43,10 @@ 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, ) @@ -833,7 +835,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + 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: @@ -1067,7 +1071,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + 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: @@ -1157,6 +1163,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, (IOBase, 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, (IOBase, 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, @@ -1617,7 +2096,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + 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: @@ -2599,7 +3080,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + 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: 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..9484963fd3dc --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_cross_region_restore_job_operations.py @@ -0,0 +1,194 @@ +# 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 io import IOBase +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, (IOBase, 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..b61b162a3cd8 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_cross_region_restore_jobs_operations.py @@ -0,0 +1,228 @@ +# 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 io import IOBase +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, (IOBase, 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/_jobs_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_jobs_operations.py index 2a959e7644e1..681a73f62dcd 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,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,15 +20,22 @@ ) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.rest import HttpRequest from azure.core.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 azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models from ..._vendor import _convert_request -from ...operations._jobs_operations import build_get_request, build_list_request +from ...operations._jobs_operations import ( + build_generate_progress_url_request, + build_get_request, + build_list_request, + build_trigger_cancel_request, +) T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -213,3 +220,195 @@ async def get( get.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs/{jobId}" } + + async def _trigger_cancel_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, vault_name: str, job_id: str, **kwargs: Any + ) -> None: + 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_trigger_cancel_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + job_id=job_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._trigger_cancel_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 [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _trigger_cancel_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs/{jobId}/triggerCancel" + } + + @distributed_trace_async + async def begin_trigger_cancel( + self, resource_group_name: str, vault_name: str, job_id: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Triggers cancellation of Job and returns an OperationID to track. + + :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 job_id: The Job ID. This is a GUID-formatted string (e.g. + 00000000-0000-0000-0000-000000000000). Required. + :type job_id: 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 None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :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[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._trigger_cancel_initial( # type: ignore + resource_group_name=resource_group_name, + vault_name=vault_name, + job_id=job_id, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + 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_cancel.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs/{jobId}/triggerCancel" + } + + @distributed_trace_async + async def generate_progress_url( + self, resource_group_name: str, vault_name: str, job_id: str, **kwargs: Any + ) -> _models.AzureBackupJobProgressUrl: + """Generates read SAS URL for a blob from which current job progress can be read. + + :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 job_id: The Job ID. This is a GUID-formatted string (e.g. + 00000000-0000-0000-0000-000000000000). Required. + :type job_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AzureBackupJobProgressUrl or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.AzureBackupJobProgressUrl + :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.AzureBackupJobProgressUrl] = kwargs.pop("cls", None) + + request = build_generate_progress_url_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + job_id=job_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.generate_progress_url.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("AzureBackupJobProgressUrl", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + generate_progress_url.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs/{jobId}/generateProgressUrl" + } 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..567a630aaf79 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_secondary_rps_operations.py @@ -0,0 +1,251 @@ +# 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 io import IOBase +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, (IOBase, 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 153218f0c516..769dc3fe4142 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 @@ -18,6 +18,7 @@ from ._models_py3 import AzureBackupFindRestorableTimeRangesResponse from ._models_py3 import AzureBackupFindRestorableTimeRangesResponseResource from ._models_py3 import AzureBackupJob +from ._models_py3 import AzureBackupJobProgressUrl from ._models_py3 import AzureBackupJobResource from ._models_py3 import AzureBackupJobResourceList from ._models_py3 import AzureBackupParams @@ -60,6 +61,10 @@ 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 @@ -68,6 +73,7 @@ from ._models_py3 import Datasource from ._models_py3 import DatasourceSet from ._models_py3 import Day +from ._models_py3 import DefaultResourceProperties from ._models_py3 import DeleteOption from ._models_py3 import DeletedBackupInstance from ._models_py3 import DeletedBackupInstanceResource @@ -91,6 +97,7 @@ 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 @@ -152,7 +159,10 @@ from ._models_py3 import UnlockDeleteRequest from ._models_py3 import UnlockDeleteResponse from ._models_py3 import UserAssignedIdentity +from ._models_py3 import UserAssignedIdentityDetails from ._models_py3 import UserFacingError +from ._models_py3 import UserFacingWarningDetail +from ._models_py3 import ValidateCrossRegionRestoreRequestObject from ._models_py3 import ValidateForBackupRequest from ._models_py3 import ValidateRestoreRequestObject @@ -175,6 +185,7 @@ from ._data_protection_mgmt_client_enums import RehydrationPriority from ._data_protection_mgmt_client_enums import RehydrationStatus from ._data_protection_mgmt_client_enums import ResourceMoveState +from ._data_protection_mgmt_client_enums import ResourcePropertiesObjectType from ._data_protection_mgmt_client_enums import RestoreSourceDataStoreType from ._data_protection_mgmt_client_enums import RestoreTargetLocationType from ._data_protection_mgmt_client_enums import SecretStoreType @@ -204,6 +215,7 @@ "AzureBackupFindRestorableTimeRangesResponse", "AzureBackupFindRestorableTimeRangesResponseResource", "AzureBackupJob", + "AzureBackupJobProgressUrl", "AzureBackupJobResource", "AzureBackupJobResourceList", "AzureBackupParams", @@ -246,6 +258,10 @@ "ClientDiscoveryValueForSingleApi", "CopyOnExpiryOption", "CopyOption", + "CrossRegionRestoreDetails", + "CrossRegionRestoreJobRequest", + "CrossRegionRestoreJobsRequest", + "CrossRegionRestoreRequestObject", "CrossRegionRestoreSettings", "CrossSubscriptionRestoreSettings", "CustomCopyOption", @@ -254,6 +270,7 @@ "Datasource", "DatasourceSet", "Day", + "DefaultResourceProperties", "DeleteOption", "DeletedBackupInstance", "DeletedBackupInstanceResource", @@ -277,6 +294,7 @@ "FeatureValidationRequestBase", "FeatureValidationResponse", "FeatureValidationResponseBase", + "FetchSecondaryRPsRequestParameters", "IdentityDetails", "ImmediateCopyOption", "ImmutabilitySettings", @@ -338,7 +356,10 @@ "UnlockDeleteRequest", "UnlockDeleteResponse", "UserAssignedIdentity", + "UserAssignedIdentityDetails", "UserFacingError", + "UserFacingWarningDetail", + "ValidateCrossRegionRestoreRequestObject", "ValidateForBackupRequest", "ValidateRestoreRequestObject", "AbsoluteMarker", @@ -360,6 +381,7 @@ "RehydrationPriority", "RehydrationStatus", "ResourceMoveState", + "ResourcePropertiesObjectType", "RestoreSourceDataStoreType", "RestoreTargetLocationType", "SecretStoreType", 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 8f1299ab71ea..ef6ce90ebe3a 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 @@ -198,6 +198,12 @@ class ResourceMoveState(str, Enum, metaclass=CaseInsensitiveEnumMeta): MOVE_SUCCEEDED = "MoveSucceeded" +class ResourcePropertiesObjectType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of the specific object - used for deserializing.""" + + DEFAULT_RESOURCE_PROPERTIES = "DefaultResourceProperties" + + class RestoreSourceDataStoreType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Gets or sets the type of the source data store.""" 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 435e8c2e4200..e6b40a6f42aa 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 @@ -748,6 +748,8 @@ class AzureBackupJob(_serialization.Model): # pylint: disable=too-many-instance :ivar restore_type: It indicates the sub type of operation i.e. in case of Restore it can be ALR/OLR. :vartype restore_type: str + :ivar source_data_store_type: The type of the source data store. + :vartype source_data_store_type: str :ivar source_resource_group: Resource Group Name of the Datasource. Required. :vartype source_resource_group: str :ivar source_subscription_id: SubscriptionId corresponding to the DataSource. Required. @@ -791,6 +793,7 @@ class AzureBackupJob(_serialization.Model): # pylint: disable=too-many-instance "progress_url": {"readonly": True}, "rehydration_priority": {"readonly": True}, "restore_type": {"readonly": True}, + "source_data_store_type": {"readonly": True}, "source_resource_group": {"required": True}, "source_subscription_id": {"required": True}, "start_time": {"required": True}, @@ -822,6 +825,7 @@ class AzureBackupJob(_serialization.Model): # pylint: disable=too-many-instance "progress_url": {"key": "progressUrl", "type": "str"}, "rehydration_priority": {"key": "rehydrationPriority", "type": "str"}, "restore_type": {"key": "restoreType", "type": "str"}, + "source_data_store_type": {"key": "sourceDataStoreType", "type": "str"}, "source_resource_group": {"key": "sourceResourceGroup", "type": "str"}, "source_subscription_id": {"key": "sourceSubscriptionID", "type": "str"}, "start_time": {"key": "startTime", "type": "iso-8601"}, @@ -933,6 +937,7 @@ def __init__( # pylint: disable=too-many-locals self.progress_url = None self.rehydration_priority = None self.restore_type = None + self.source_data_store_type = None self.source_resource_group = source_resource_group self.source_subscription_id = source_subscription_id self.start_time = start_time @@ -945,6 +950,26 @@ def __init__( # pylint: disable=too-many-locals self.destination_data_store_name = destination_data_store_name +class AzureBackupJobProgressUrl(_serialization.Model): + """Job Progress URL class. + + :ivar progress_url: Read SAS URI for a blob from which current job progress can be read. + :vartype progress_url: str + """ + + _attribute_map = { + "progress_url": {"key": "progressUrl", "type": "str"}, + } + + def __init__(self, *, progress_url: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword progress_url: Read SAS URI for a blob from which current job progress can be read. + :paramtype progress_url: str + """ + super().__init__(**kwargs) + self.progress_url = progress_url + + class AzureBackupJobResource(DppResource): """AzureBackup Job Resource Class. @@ -2617,10 +2642,14 @@ def __init__( class BaseResourceProperties(_serialization.Model): """Properties which are specific to datasource/datasourceSets. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + DefaultResourceProperties + All required parameters must be populated in order to send to Azure. :ivar object_type: Type of the specific object - used for deserializing. Required. - :vartype object_type: str + "DefaultResourceProperties" + :vartype object_type: str or ~azure.mgmt.dataprotection.models.ResourcePropertiesObjectType """ _validation = { @@ -2631,6 +2660,8 @@ class BaseResourceProperties(_serialization.Model): "object_type": {"key": "objectType", "type": "str"}, } + _subtype_map = {"object_type": {"DefaultResourceProperties": "DefaultResourceProperties"}} + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) @@ -3012,6 +3043,153 @@ 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. @@ -3315,6 +3493,30 @@ def __init__(self, *, date: Optional[int] = None, is_last: Optional[bool] = None self.is_last = is_last +class DefaultResourceProperties(BaseResourceProperties): + """Default source properties. + + All required parameters must be populated in order to send to Azure. + + :ivar object_type: Type of the specific object - used for deserializing. Required. + "DefaultResourceProperties" + :vartype object_type: str or ~azure.mgmt.dataprotection.models.ResourcePropertiesObjectType + """ + + _validation = { + "object_type": {"required": True}, + } + + _attribute_map = { + "object_type": {"key": "objectType", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.object_type: str = "DefaultResourceProperties" + + class DeletedBackupInstance(BackupInstance): # pylint: disable=too-many-instance-attributes """Deleted Backup Instance. @@ -3980,6 +4182,36 @@ 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. @@ -4338,6 +4570,8 @@ class JobExtendedInfo(_serialization.Model): :vartype sub_tasks: list[~azure.mgmt.dataprotection.models.JobSubTask] :ivar target_recover_point: Details of the Target Recovery Point. :vartype target_recover_point: ~azure.mgmt.dataprotection.models.RestoreJobRecoveryPointDetails + :ivar warning_details: A List, detailing the warnings related to the job. + :vartype warning_details: list[~azure.mgmt.dataprotection.models.UserFacingWarningDetail] """ _validation = { @@ -4347,6 +4581,7 @@ class JobExtendedInfo(_serialization.Model): "source_recover_point": {"readonly": True}, "sub_tasks": {"readonly": True}, "target_recover_point": {"readonly": True}, + "warning_details": {"readonly": True}, } _attribute_map = { @@ -4357,6 +4592,7 @@ class JobExtendedInfo(_serialization.Model): "source_recover_point": {"key": "sourceRecoverPoint", "type": "RestoreJobRecoveryPointDetails"}, "sub_tasks": {"key": "subTasks", "type": "[JobSubTask]"}, "target_recover_point": {"key": "targetRecoverPoint", "type": "RestoreJobRecoveryPointDetails"}, + "warning_details": {"key": "warningDetails", "type": "[UserFacingWarningDetail]"}, } def __init__(self, *, additional_details: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: @@ -4372,6 +4608,7 @@ def __init__(self, *, additional_details: Optional[Dict[str, str]] = None, **kwa self.source_recover_point = None self.sub_tasks = None self.target_recover_point = None + self.warning_details = None class JobSubTask(_serialization.Model): @@ -4578,6 +4815,12 @@ class KubernetesClusterRestoreCriteria(ItemLevelRestoreCriteria): # pylint: dis hook reference to be executed during restore. :vartype restore_hook_references: list[~azure.mgmt.dataprotection.models.NamespacedNameResource] + :ivar staging_resource_group_id: Gets or sets the staging RG Id for creating staging disks and + snapshots during restore. + :vartype staging_resource_group_id: str + :ivar staging_storage_account_id: Gets or sets the staging Storage Account Id for creating + backup object store data during restore. + :vartype staging_storage_account_id: str """ _validation = { @@ -4597,6 +4840,8 @@ class KubernetesClusterRestoreCriteria(ItemLevelRestoreCriteria): # pylint: dis "conflict_policy": {"key": "conflictPolicy", "type": "str"}, "namespace_mappings": {"key": "namespaceMappings", "type": "{str}"}, "restore_hook_references": {"key": "restoreHookReferences", "type": "[NamespacedNameResource]"}, + "staging_resource_group_id": {"key": "stagingResourceGroupId", "type": "str"}, + "staging_storage_account_id": {"key": "stagingStorageAccountId", "type": "str"}, } def __init__( @@ -4612,6 +4857,8 @@ def __init__( conflict_policy: Optional[Union[str, "_models.ExistingResourcePolicy"]] = None, namespace_mappings: Optional[Dict[str, str]] = None, restore_hook_references: Optional[List["_models.NamespacedNameResource"]] = None, + staging_resource_group_id: Optional[str] = None, + staging_storage_account_id: Optional[str] = None, **kwargs: Any ) -> None: """ @@ -4648,6 +4895,12 @@ def __init__( the hook reference to be executed during restore. :paramtype restore_hook_references: list[~azure.mgmt.dataprotection.models.NamespacedNameResource] + :keyword staging_resource_group_id: Gets or sets the staging RG Id for creating staging disks + and snapshots during restore. + :paramtype staging_resource_group_id: str + :keyword staging_storage_account_id: Gets or sets the staging Storage Account Id for creating + backup object store data during restore. + :paramtype staging_storage_account_id: str """ super().__init__(**kwargs) self.object_type: str = "KubernetesClusterRestoreCriteria" @@ -4661,6 +4914,8 @@ def __init__( self.conflict_policy = conflict_policy self.namespace_mappings = namespace_mappings self.restore_hook_references = restore_hook_references + self.staging_resource_group_id = staging_resource_group_id + self.staging_storage_account_id = staging_storage_account_id class KubernetesPVRestoreCriteria(ItemLevelRestoreCriteria): @@ -6680,6 +6935,34 @@ def __init__(self, **kwargs: Any) -> None: self.client_id = None +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. @@ -6761,6 +7044,82 @@ def __init__( self.target = target +class UserFacingWarningDetail(_serialization.Model): + """Warning object used by layers that have access to localized content, and propagate that to + user. + + All required parameters must be populated in order to send to Azure. + + :ivar resource_name: Name of resource for which warning is raised. + :vartype resource_name: str + :ivar warning: Error details for the warning. Required. + :vartype warning: ~azure.mgmt.dataprotection.models.UserFacingError + """ + + _validation = { + "warning": {"required": True}, + } + + _attribute_map = { + "resource_name": {"key": "resourceName", "type": "str"}, + "warning": {"key": "warning", "type": "UserFacingError"}, + } + + def __init__( + self, *, warning: "_models.UserFacingError", resource_name: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword resource_name: Name of resource for which warning is raised. + :paramtype resource_name: str + :keyword warning: Error details for the warning. Required. + :paramtype warning: ~azure.mgmt.dataprotection.models.UserFacingError + """ + super().__init__(**kwargs) + self.resource_name = resource_name + self.warning = warning + + +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 0bf84afef994..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,6 +17,10 @@ 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 @@ -41,6 +45,10 @@ "BackupPoliciesOperations", "BackupInstancesOperations", "RecoveryPointsOperations", + "SecondaryRPsOperations", + "CrossRegionRestoreJobOperations", + "CrossRegionRestoreJobsOperations", + "BackupInstancesExtensionRoutingOperations", "JobsOperations", "RestorableTimeRangesOperations", "ExportJobsOperations", 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..b2ae3f46443f --- /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 + +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-06-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 = _url.format(**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 f3e5e9a9454d..221ec09a1774 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 @@ -30,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +43,7 @@ def build_list_request(resource_group_name: str, vault_name: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59,7 +59,7 @@ def build_list_request(resource_group_name: str, vault_name: str, subscription_i "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -76,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,7 +93,7 @@ def build_get_request( "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -110,7 +110,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -128,7 +128,7 @@ def build_create_or_update_request( "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -147,7 +147,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -164,7 +164,7 @@ def build_delete_request( "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -181,7 +181,7 @@ def build_adhoc_backup_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -199,7 +199,7 @@ def build_adhoc_backup_request( "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -218,7 +218,7 @@ def build_validate_for_backup_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -235,7 +235,7 @@ def build_validate_for_backup_request( "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -259,7 +259,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -277,7 +277,7 @@ def build_get_backup_instance_operation_result_request( "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -288,13 +288,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( + 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-06-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 = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_validate_cross_region_restore_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-06-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 = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + def build_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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -312,7 +384,7 @@ def build_trigger_rehydrate_request( "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -331,7 +403,7 @@ def build_trigger_restore_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -349,7 +421,7 @@ def build_trigger_restore_request( "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -368,7 +440,7 @@ def build_resume_backups_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -385,7 +457,7 @@ def build_resume_backups_request( "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -402,7 +474,7 @@ def build_resume_protection_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -419,7 +491,7 @@ def build_resume_protection_request( "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -436,7 +508,7 @@ def build_stop_protection_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -453,7 +525,7 @@ def build_stop_protection_request( "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -470,7 +542,7 @@ def build_suspend_backups_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -487,7 +559,7 @@ def build_suspend_backups_request( "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -504,7 +576,7 @@ def build_sync_backup_instance_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -522,7 +594,7 @@ def build_sync_backup_instance_request( "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -541,7 +613,7 @@ def build_validate_for_restore_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -559,7 +631,7 @@ def build_validate_for_restore_request( "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -1348,7 +1420,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + 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: @@ -1582,7 +1656,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + 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: @@ -1672,6 +1748,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, (IOBase, 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, (IOBase, 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, @@ -2132,7 +2681,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + 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: @@ -3114,7 +3665,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + 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: 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 fa1aae664226..22ab332c7ddb 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 @@ -28,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,7 +41,7 @@ def build_list_request(resource_group_name: str, vault_name: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -57,7 +57,7 @@ def build_list_request(resource_group_name: str, vault_name: str, subscription_i "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -74,7 +74,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -91,7 +91,7 @@ def build_get_request( "backupPolicyName": _SERIALIZER.url("backup_policy_name", backup_policy_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -108,7 +108,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -126,7 +126,7 @@ def build_create_or_update_request( "backupPolicyName": _SERIALIZER.url("backup_policy_name", backup_policy_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -145,7 +145,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +162,7 @@ def build_delete_request( "backupPolicyName": _SERIALIZER.url("backup_policy_name", backup_policy_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") 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 324177fb55bb..5b535a9b7e81 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 @@ -25,7 +25,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -57,7 +57,7 @@ def build_get_request( "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") 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 ba4deb368eb2..6da684eebc07 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 @@ -30,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +43,7 @@ def build_get_in_subscription_request(subscription_id: str, **kwargs: Any) -> Ht _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +52,7 @@ def build_get_in_subscription_request(subscription_id: str, **kwargs: Any) -> Ht "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -67,7 +67,7 @@ def build_get_in_resource_group_request(resource_group_name: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,7 +82,7 @@ def build_get_in_resource_group_request(resource_group_name: str, subscription_i "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -97,7 +97,7 @@ def build_get_request(resource_group_name: str, vault_name: str, subscription_id _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -113,7 +113,7 @@ def build_get_request(resource_group_name: str, vault_name: str, subscription_id "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -130,7 +130,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -147,7 +147,7 @@ def build_create_or_update_request( "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -164,7 +164,7 @@ def build_delete_request(resource_group_name: str, vault_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -180,7 +180,7 @@ def build_delete_request(resource_group_name: str, vault_name: str, subscription "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -195,7 +195,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -212,7 +212,7 @@ def build_update_request(resource_group_name: str, vault_name: str, subscription "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -231,7 +231,7 @@ def build_check_name_availability_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -248,7 +248,7 @@ def build_check_name_availability_request( "location": _SERIALIZER.url("location", location, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") 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..22ce141dfccf --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_cross_region_restore_job_operations.py @@ -0,0 +1,231 @@ +# 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 io import IOBase +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 + +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-06-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 = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +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, (IOBase, 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..bfa2097b4c87 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_cross_region_restore_jobs_operations.py @@ -0,0 +1,262 @@ +# 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 io import IOBase +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 + +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-06-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 = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +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, (IOBase, 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 c0c28831d01d..52a9eff7fee0 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 @@ -26,7 +26,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,7 +39,7 @@ def build_check_feature_support_request(location: str, subscription_id: str, **k _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -53,7 +53,7 @@ def build_check_feature_support_request(location: str, subscription_id: str, **k "location": _SERIALIZER.url("location", location, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") 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 df9eba055791..c5a5adcb409f 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 @@ -40,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL 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 6e03466ec99f..935e172ad54a 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 @@ -29,7 +29,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +42,7 @@ def build_list_request(resource_group_name: str, vault_name: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +58,7 @@ def build_list_request(resource_group_name: str, vault_name: str, subscription_i "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -75,7 +75,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,7 +92,7 @@ def build_get_request( "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -109,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -126,7 +126,7 @@ def build_undelete_request( "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_dpp_resource_guard_proxy_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_dpp_resource_guard_proxy_operations.py index 1d06f91b43e2..bf01f316554e 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_dpp_resource_guard_proxy_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_dpp_resource_guard_proxy_operations.py @@ -28,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,7 +41,7 @@ def build_list_request(resource_group_name: str, vault_name: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -57,7 +57,7 @@ def build_list_request(resource_group_name: str, vault_name: str, subscription_i "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -74,7 +74,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,7 +93,7 @@ def build_get_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -110,7 +110,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -130,7 +130,7 @@ def build_create_or_update_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -149,7 +149,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -168,7 +168,7 @@ def build_delete_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -185,7 +185,7 @@ def build_unlock_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -205,7 +205,7 @@ def build_unlock_delete_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") 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 d3de324fd046..67fac99e9557 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 @@ -25,7 +25,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -57,7 +57,7 @@ def build_get_request( "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") 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 dc89dafb70fd..3dbeb6eff94e 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 @@ -27,7 +27,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +58,7 @@ def build_trigger_request( "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") 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 4a2875ff305a..41391d6d01ee 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,7 @@ # 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 +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast import urllib.parse from azure.core.exceptions import ( @@ -20,14 +20,16 @@ from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +42,7 @@ def build_list_request(resource_group_name: str, vault_name: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +58,7 @@ def build_list_request(resource_group_name: str, vault_name: str, subscription_i "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -73,7 +75,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -90,7 +92,7 @@ def build_get_request( "jobId": _SERIALIZER.url("job_id", job_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -101,6 +103,74 @@ def build_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) +def build_trigger_cancel_request( + resource_group_name: str, vault_name: str, job_id: 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-06-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs/{jobId}/triggerCancel", + ) # 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"), + "jobId": _SERIALIZER.url("job_id", job_id, "str"), + } + + _url: str = _url.format(**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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_generate_progress_url_request( + resource_group_name: str, vault_name: str, job_id: 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-06-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs/{jobId}/generateProgressUrl", + ) # 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"), + "jobId": _SERIALIZER.url("job_id", job_id, "str"), + } + + _url: str = _url.format(**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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + class JobsOperations: """ .. warning:: @@ -279,3 +349,195 @@ def get( get.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs/{jobId}" } + + def _trigger_cancel_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, vault_name: str, job_id: str, **kwargs: Any + ) -> None: + 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_trigger_cancel_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + job_id=job_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._trigger_cancel_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 [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _trigger_cancel_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs/{jobId}/triggerCancel" + } + + @distributed_trace + def begin_trigger_cancel( + self, resource_group_name: str, vault_name: str, job_id: str, **kwargs: Any + ) -> LROPoller[None]: + """Triggers cancellation of Job and returns an OperationID to track. + + :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 job_id: The Job ID. This is a GUID-formatted string (e.g. + 00000000-0000-0000-0000-000000000000). Required. + :type job_id: 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 None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :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[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._trigger_cancel_initial( # type: ignore + resource_group_name=resource_group_name, + vault_name=vault_name, + job_id=job_id, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + 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_cancel.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs/{jobId}/triggerCancel" + } + + @distributed_trace + def generate_progress_url( + self, resource_group_name: str, vault_name: str, job_id: str, **kwargs: Any + ) -> _models.AzureBackupJobProgressUrl: + """Generates read SAS URL for a blob from which current job progress can be read. + + :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 job_id: The Job ID. This is a GUID-formatted string (e.g. + 00000000-0000-0000-0000-000000000000). Required. + :type job_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AzureBackupJobProgressUrl or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.AzureBackupJobProgressUrl + :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.AzureBackupJobProgressUrl] = kwargs.pop("cls", None) + + request = build_generate_progress_url_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + job_id=job_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.generate_progress_url.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("AzureBackupJobProgressUrl", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + generate_progress_url.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs/{jobId}/generateProgressUrl" + } 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 7b432322ebef..1eb7935f0ae8 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 @@ -25,7 +25,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +52,7 @@ def build_get_request(operation_id: str, location: str, subscription_id: str, ** "location": _SERIALIZER.url("location", location, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") 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 41ab41ca2d5b..39c7b829f5c7 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 @@ -25,7 +25,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -57,7 +57,7 @@ def build_get_request( "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") 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 51f0b6485661..80267496286b 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 @@ -25,7 +25,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +52,7 @@ def build_get_request(location: str, operation_id: str, subscription_id: str, ** "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") 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 7b347c432710..cddc7f61388d 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 @@ -25,7 +25,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +54,7 @@ def build_get_request(resource_group_name: str, operation_id: str, subscription_ "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") 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 da0c5e2e7cbe..2202fb416d7b 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 @@ -27,7 +27,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,7 +66,7 @@ def build_list_request( "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -92,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -110,7 +110,7 @@ def build_get_request( "recoveryPointId": _SERIALIZER.url("recovery_point_id", recovery_point_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") 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 5e052e3e5a81..f20c508445dc 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 @@ -28,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,7 +41,7 @@ def build_get_resources_in_subscription_request(subscription_id: str, **kwargs: _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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +52,7 @@ def build_get_resources_in_subscription_request(subscription_id: str, **kwargs: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -69,7 +69,7 @@ def build_get_resources_in_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -84,7 +84,7 @@ def build_get_resources_in_resource_group_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -101,7 +101,7 @@ def build_put_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -118,7 +118,7 @@ def build_put_request( "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -137,7 +137,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -153,7 +153,7 @@ def build_get_request( "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -170,7 +170,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -186,7 +186,7 @@ def build_delete_request( "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -203,7 +203,7 @@ def build_patch_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -220,7 +220,7 @@ def build_patch_request( "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -239,7 +239,7 @@ def build_get_disable_soft_delete_requests_objects_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -255,7 +255,7 @@ def build_get_disable_soft_delete_requests_objects_request( "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -272,7 +272,7 @@ def build_get_delete_resource_guard_proxy_requests_objects_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -288,7 +288,7 @@ def build_get_delete_resource_guard_proxy_requests_objects_request( "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -305,7 +305,7 @@ def build_get_backup_security_pin_requests_objects_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -321,7 +321,7 @@ def build_get_backup_security_pin_requests_objects_request( "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -338,7 +338,7 @@ def build_get_delete_protected_item_requests_objects_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -354,7 +354,7 @@ def build_get_delete_protected_item_requests_objects_request( "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -371,7 +371,7 @@ def build_get_update_protection_policy_requests_objects_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -387,7 +387,7 @@ def build_get_update_protection_policy_requests_objects_request( "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -404,7 +404,7 @@ def build_get_update_protected_item_requests_objects_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -420,7 +420,7 @@ def build_get_update_protected_item_requests_objects_request( "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -437,7 +437,7 @@ def build_get_default_disable_soft_delete_requests_object_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -454,7 +454,7 @@ def build_get_default_disable_soft_delete_requests_object_request( "requestName": _SERIALIZER.url("request_name", request_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -471,7 +471,7 @@ def build_get_default_delete_resource_guard_proxy_requests_object_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -488,7 +488,7 @@ def build_get_default_delete_resource_guard_proxy_requests_object_request( "requestName": _SERIALIZER.url("request_name", request_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -505,7 +505,7 @@ def build_get_default_backup_security_pin_requests_object_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -522,7 +522,7 @@ def build_get_default_backup_security_pin_requests_object_request( "requestName": _SERIALIZER.url("request_name", request_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -539,7 +539,7 @@ def build_get_default_delete_protected_item_requests_object_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -556,7 +556,7 @@ def build_get_default_delete_protected_item_requests_object_request( "requestName": _SERIALIZER.url("request_name", request_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -573,7 +573,7 @@ def build_get_default_update_protection_policy_requests_object_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -590,7 +590,7 @@ def build_get_default_update_protection_policy_requests_object_request( "requestName": _SERIALIZER.url("request_name", request_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -607,7 +607,7 @@ def build_get_default_update_protected_item_requests_object_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -624,7 +624,7 @@ def build_get_default_update_protected_item_requests_object_request( "requestName": _SERIALIZER.url("request_name", request_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") 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 d0fd1db34909..4d382fb78aa0 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 @@ -26,7 +26,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,7 +41,7 @@ def build_find_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -59,7 +59,7 @@ def build_find_request( "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") 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..16284e147848 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_secondary_rps_operations.py @@ -0,0 +1,300 @@ +# 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 io import IOBase +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 + +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-06-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 = _url.format(**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, (IOBase, 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/backup_instance_operations/delete_backup_instance.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/delete_backup_instance.py index 910cb8a3bea9..7a6c4ce992f6 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/delete_backup_instance.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/delete_backup_instance.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/BackupInstanceOperations/DeleteBackupInstance.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/BackupInstanceOperations/DeleteBackupInstance.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/find_restorable_time_ranges.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/find_restorable_time_ranges.py index 3d3ca5f9c3b9..5afb8553b60f 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/find_restorable_time_ranges.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/find_restorable_time_ranges.py @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/BackupInstanceOperations/FindRestorableTimeRanges.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/BackupInstanceOperations/FindRestorableTimeRanges.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/get_backup_instance.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/get_backup_instance.py index 4009afc8767a..bb0c3895dc24 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/get_backup_instance.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/get_backup_instance.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/BackupInstanceOperations/GetBackupInstance.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/BackupInstanceOperations/GetBackupInstance.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/get_backup_instance_operation_result.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/get_backup_instance_operation_result.py index 1d6ded65f970..1a4b80da065c 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/get_backup_instance_operation_result.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/get_backup_instance_operation_result.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/BackupInstanceOperations/GetBackupInstanceOperationResult.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/BackupInstanceOperations/GetBackupInstanceOperationResult.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/get_recovery_point.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/get_recovery_point.py index de9e2473bad2..d23d33ab56f0 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/get_recovery_point.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/get_recovery_point.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/BackupInstanceOperations/GetRecoveryPoint.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/BackupInstanceOperations/GetRecoveryPoint.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/list_backup_instances.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/list_backup_instances.py index a9748e6da0e3..1c918804b557 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/list_backup_instances.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/list_backup_instances.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/BackupInstanceOperations/ListBackupInstances.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/BackupInstanceOperations/ListBackupInstances.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/list_backup_instances_extension_routing.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/list_backup_instances_extension_routing.py new file mode 100644 index 000000000000..6fd38e7a154d --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/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-06-01-preview/examples/BackupInstanceOperations/ListBackupInstancesExtensionRouting.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/list_recovery_points.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/list_recovery_points.py index a07e4ea9c063..3921e41bbb83 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/list_recovery_points.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/list_recovery_points.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/BackupInstanceOperations/ListRecoveryPoints.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/BackupInstanceOperations/ListRecoveryPoints.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/put_backup_instance.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/put_backup_instance.py index d3a9d6ea8556..d2264a7c23b9 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/put_backup_instance.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/put_backup_instance.py @@ -82,6 +82,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/BackupInstanceOperations/PutBackupInstance.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/BackupInstanceOperations/PutBackupInstance.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/resume_backups.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/resume_backups.py index 1021bddc92c6..e3294085474f 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/resume_backups.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/resume_backups.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/BackupInstanceOperations/ResumeBackups.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/BackupInstanceOperations/ResumeBackups.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/resume_protection.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/resume_protection.py index 12e866da8c59..03d6a7f6c75c 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/resume_protection.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/resume_protection.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/BackupInstanceOperations/ResumeProtection.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/BackupInstanceOperations/ResumeProtection.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/stop_protection.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/stop_protection.py index 3033968970f5..c4fe7cb8c88b 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/stop_protection.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/stop_protection.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/BackupInstanceOperations/StopProtection.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/BackupInstanceOperations/StopProtection.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/suspend_backups.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/suspend_backups.py index f9999f367812..e9d8aa9e7fea 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/suspend_backups.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/suspend_backups.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/BackupInstanceOperations/SuspendBackups.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/BackupInstanceOperations/SuspendBackups.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/sync_backup_instance.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/sync_backup_instance.py index e8a04b7e6533..6d87f790fd55 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/sync_backup_instance.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/sync_backup_instance.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/BackupInstanceOperations/SyncBackupInstance.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/BackupInstanceOperations/SyncBackupInstance.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/trigger_backup.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/trigger_backup.py index dcfcb2f928d8..058fa09c9330 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/trigger_backup.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/trigger_backup.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/BackupInstanceOperations/TriggerBackup.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/BackupInstanceOperations/TriggerBackup.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/trigger_rehydrate.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/trigger_rehydrate.py index 709c39aaae76..5bda9639947f 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/trigger_rehydrate.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/trigger_rehydrate.py @@ -41,6 +41,6 @@ def main(): ).result() -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/BackupInstanceOperations/TriggerRehydrate.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/BackupInstanceOperations/TriggerRehydrate.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/trigger_restore.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/trigger_restore.py index 536d9c5d3378..e16319a127c5 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/trigger_restore.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/trigger_restore.py @@ -73,6 +73,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/BackupInstanceOperations/TriggerRestore.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/BackupInstanceOperations/TriggerRestore.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/trigger_restore_as_files.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/trigger_restore_as_files.py index 52d13304639b..097d747e7224 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/trigger_restore_as_files.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/trigger_restore_as_files.py @@ -53,6 +53,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/BackupInstanceOperations/TriggerRestoreAsFiles.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/BackupInstanceOperations/TriggerRestoreAsFiles.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/trigger_restore_with_rehydration.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/trigger_restore_with_rehydration.py index 990dcf8ad3fd..c81a45bc7648 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/trigger_restore_with_rehydration.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/trigger_restore_with_rehydration.py @@ -68,6 +68,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/BackupInstanceOperations/TriggerRestoreWithRehydration.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/BackupInstanceOperations/TriggerRestoreWithRehydration.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/validate_for_backup.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/validate_for_backup.py index 63cbbebe8e8c..ae20b10d890e 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/validate_for_backup.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/validate_for_backup.py @@ -70,6 +70,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/BackupInstanceOperations/ValidateForBackup.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/BackupInstanceOperations/ValidateForBackup.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/validate_restore.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/validate_restore.py index 9573837d989a..91fb47158ca3 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/validate_restore.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/validate_restore.py @@ -75,6 +75,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/BackupInstanceOperations/ValidateRestore.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/BackupInstanceOperations/ValidateRestore.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/checkfeature_support.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/checkfeature_support.py index cdfef822bdd7..97375309f057 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-05-01/examples/CheckfeatureSupport.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/CheckfeatureSupport.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/cross_region_restore/fetch_cross_region_restore_job.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/cross_region_restore/fetch_cross_region_restore_job.py new file mode 100644 index 000000000000..0ee2a5bcc391 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/cross_region_restore/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-06-01-preview/examples/CrossRegionRestore/FetchCrossRegionRestoreJob.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/cross_region_restore/fetch_cross_region_restore_jobs.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/cross_region_restore/fetch_cross_region_restore_jobs.py new file mode 100644 index 000000000000..5fc001edbc6b --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/cross_region_restore/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-06-01-preview/examples/CrossRegionRestore/FetchCrossRegionRestoreJobs.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/cross_region_restore/fetch_secondary_rps.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/cross_region_restore/fetch_secondary_rps.py new file mode 100644 index 000000000000..5812cff3330d --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/cross_region_restore/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-06-01-preview/examples/CrossRegionRestore/FetchSecondaryRPs.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/cross_region_restore/trigger_cross_region_restore.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/cross_region_restore/trigger_cross_region_restore.py new file mode 100644 index 000000000000..49ba8323bf31 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/cross_region_restore/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-06-01-preview/examples/CrossRegionRestore/TriggerCrossRegionRestore.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/cross_region_restore/validate_cross_region_restore.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/cross_region_restore/validate_cross_region_restore.py new file mode 100644 index 000000000000..64b2c37a96e0 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/cross_region_restore/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-06-01-preview/examples/CrossRegionRestore/ValidateCrossRegionRestore.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/deleted_backup_instance_operations/get_deleted_backup_instance.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/deleted_backup_instance_operations/get_deleted_backup_instance.py index a87772c9c313..14d751e5e32d 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/deleted_backup_instance_operations/get_deleted_backup_instance.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/deleted_backup_instance_operations/get_deleted_backup_instance.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/DeletedBackupInstanceOperations/GetDeletedBackupInstance.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/DeletedBackupInstanceOperations/GetDeletedBackupInstance.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/deleted_backup_instance_operations/list_deleted_backup_instances.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/deleted_backup_instance_operations/list_deleted_backup_instances.py index dfe33c91e4eb..72522cc3b889 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/deleted_backup_instance_operations/list_deleted_backup_instances.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/deleted_backup_instance_operations/list_deleted_backup_instances.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/DeletedBackupInstanceOperations/ListDeletedBackupInstances.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/DeletedBackupInstanceOperations/ListDeletedBackupInstances.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/deleted_backup_instance_operations/undelete_deleted_backup_instance.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/deleted_backup_instance_operations/undelete_deleted_backup_instance.py index f9f9b202b92f..e2cfddf1ef90 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/deleted_backup_instance_operations/undelete_deleted_backup_instance.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/deleted_backup_instance_operations/undelete_deleted_backup_instance.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/DeletedBackupInstanceOperations/UndeleteDeletedBackupInstance.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/DeletedBackupInstanceOperations/UndeleteDeletedBackupInstance.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_result.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_result.py index 1b5b3634c7a2..2470069cc804 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-05-01/examples/GetOperationResult.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/GetOperationResult.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_status.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_status.py index 393891eeeee2..63185c40b5eb 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-05-01/examples/GetOperationStatus.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-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 ff8cb7be1c76..1f36a71beeb4 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-05-01/examples/GetOperationStatusRGContext.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-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 e32ed7baec9c..c82cf2905300 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-05-01/examples/GetOperationStatusVaultContext.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/GetOperationStatusVaultContext.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/job_crud/generate_progress_url.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/job_crud/generate_progress_url.py new file mode 100644 index 000000000000..d1dbc6ccf81b --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/job_crud/generate_progress_url.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 generate_progress_url.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.jobs.generate_progress_url( + resource_group_name="SwaggerTestRg", + vault_name="NetSDKTestVault", + job_id="3c60cb49-63e8-4b21-b9bd-26277b3fdfae", + ) + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/JobCRUD/GenerateProgressURL.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/job_crud/get_export_jobs_operation_result.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/job_crud/get_export_jobs_operation_result.py index daf982861dc5..76e33c378ac4 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/job_crud/get_export_jobs_operation_result.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/job_crud/get_export_jobs_operation_result.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/JobCRUD/GetExportJobsOperationResult.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/JobCRUD/GetExportJobsOperationResult.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/job_crud/get_job.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/job_crud/get_job.py index ff2fd9bd7321..b910f3f7ac0b 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/job_crud/get_job.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/job_crud/get_job.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/JobCRUD/GetJob.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/JobCRUD/GetJob.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/job_crud/list_jobs.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/job_crud/list_jobs.py index ba789cd5b80a..36b41a5ab2ce 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/job_crud/list_jobs.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/job_crud/list_jobs.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/JobCRUD/ListJobs.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/JobCRUD/ListJobs.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/job_crud/trigger_cancel.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/job_crud/trigger_cancel.py new file mode 100644 index 000000000000..e15032b20e47 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/job_crud/trigger_cancel.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 trigger_cancel.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", + ) + + client.jobs.begin_trigger_cancel( + resource_group_name="SwaggerTestRg", + vault_name="NetSDKTestVault", + job_id="3c60cb49-63e8-4b21-b9bd-26277b3fdfae", + ).result() + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/JobCRUD/TriggerCancel.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/job_crud/trigger_export_jobs.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/job_crud/trigger_export_jobs.py index 8dbd3304b352..85e4467fa063 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/job_crud/trigger_export_jobs.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/job_crud/trigger_export_jobs.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/JobCRUD/TriggerExportJobs.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/JobCRUD/TriggerExportJobs.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/operations/list.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/operations/list.py index d6691da9726f..97ab6b0073f1 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/operations/list.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/operations/list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/Operations/List.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/Operations/List.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/policy_crud/create_or_update_backup_policy.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/policy_crud/create_or_update_backup_policy.py index 76f5274f95b9..167f99e446ca 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/policy_crud/create_or_update_backup_policy.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/policy_crud/create_or_update_backup_policy.py @@ -92,6 +92,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/PolicyCRUD/CreateOrUpdateBackupPolicy.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/PolicyCRUD/CreateOrUpdateBackupPolicy.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/policy_crud/delete_backup_policy.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/policy_crud/delete_backup_policy.py index d3a3e773f2bc..5352d5b27516 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/policy_crud/delete_backup_policy.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/policy_crud/delete_backup_policy.py @@ -36,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/PolicyCRUD/DeleteBackupPolicy.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/PolicyCRUD/DeleteBackupPolicy.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/policy_crud/get_backup_policy.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/policy_crud/get_backup_policy.py index 5522adaa8be6..feceb68d3b47 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/policy_crud/get_backup_policy.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/policy_crud/get_backup_policy.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/PolicyCRUD/GetBackupPolicy.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/PolicyCRUD/GetBackupPolicy.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/policy_crud/list_backup_policy.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/policy_crud/list_backup_policy.py index 6e32b5551410..692225270097 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/policy_crud/list_backup_policy.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/policy_crud/list_backup_policy.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/PolicyCRUD/ListBackupPolicy.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/PolicyCRUD/ListBackupPolicy.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/delete_resource_guard.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/delete_resource_guard.py index 7c68b5f8c55d..a46550f3cc0c 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/delete_resource_guard.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/delete_resource_guard.py @@ -35,6 +35,6 @@ def main(): ) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/ResourceGuardCRUD/DeleteResourceGuard.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/ResourceGuardCRUD/DeleteResourceGuard.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_backup_security_pin_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_backup_security_pin_requests.py index 95550a9d0552..26d67bfcf97e 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_backup_security_pin_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_backup_security_pin_requests.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/ResourceGuardCRUD/GetDefaultBackupSecurityPINRequests.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/ResourceGuardCRUD/GetDefaultBackupSecurityPINRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_delete_protected_item_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_delete_protected_item_requests.py index d87543f09089..4fc100eb1c2e 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_delete_protected_item_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_delete_protected_item_requests.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/ResourceGuardCRUD/GetDefaultDeleteProtectedItemRequests.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/ResourceGuardCRUD/GetDefaultDeleteProtectedItemRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_delete_resource_guard_proxy_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_delete_resource_guard_proxy_requests.py index d3913d600e3f..c06256d6c49d 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_delete_resource_guard_proxy_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_delete_resource_guard_proxy_requests.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/ResourceGuardCRUD/GetDefaultDeleteResourceGuardProxyRequests.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/ResourceGuardCRUD/GetDefaultDeleteResourceGuardProxyRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_disable_soft_delete_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_disable_soft_delete_requests.py index 843c8962744c..9e483768eca8 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_disable_soft_delete_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_disable_soft_delete_requests.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/ResourceGuardCRUD/GetDefaultDisableSoftDeleteRequests.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/ResourceGuardCRUD/GetDefaultDisableSoftDeleteRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_update_protected_item_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_update_protected_item_requests.py index ea77f72c6b89..0923a6177236 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_update_protected_item_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_update_protected_item_requests.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/ResourceGuardCRUD/GetDefaultUpdateProtectedItemRequests.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/ResourceGuardCRUD/GetDefaultUpdateProtectedItemRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_update_protection_policy_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_update_protection_policy_requests.py index 34a9b6e7f409..ce4c69661379 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_update_protection_policy_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_update_protection_policy_requests.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/ResourceGuardCRUD/GetDefaultUpdateProtectionPolicyRequests.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/ResourceGuardCRUD/GetDefaultUpdateProtectionPolicyRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_resource_guard.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_resource_guard.py index eb1a1284a187..e7f296e235ed 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_resource_guard.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_resource_guard.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/ResourceGuardCRUD/GetResourceGuard.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/ResourceGuardCRUD/GetResourceGuard.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_resource_guards_in_resource_group.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_resource_guards_in_resource_group.py index 4f81a4a70827..67d46657a2b3 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_resource_guards_in_resource_group.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_resource_guards_in_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/ResourceGuardCRUD/GetResourceGuardsInResourceGroup.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/ResourceGuardCRUD/GetResourceGuardsInResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_resource_guards_in_subscription.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_resource_guards_in_subscription.py index ef3a5853a867..310794aff932 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_resource_guards_in_subscription.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_resource_guards_in_subscription.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/ResourceGuardCRUD/GetResourceGuardsInSubscription.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/ResourceGuardCRUD/GetResourceGuardsInSubscription.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_backup_security_pin_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_backup_security_pin_requests.py index df01f32f63d6..fc12fa8af59e 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_backup_security_pin_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_backup_security_pin_requests.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/ResourceGuardCRUD/ListBackupSecurityPINRequests.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/ResourceGuardCRUD/ListBackupSecurityPINRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_delete_protected_item_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_delete_protected_item_requests.py index dadc283d6c1d..144ff0119910 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_delete_protected_item_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_delete_protected_item_requests.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/ResourceGuardCRUD/ListDeleteProtectedItemRequests.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/ResourceGuardCRUD/ListDeleteProtectedItemRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_delete_resource_guard_proxy_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_delete_resource_guard_proxy_requests.py index 563476bce2cc..d2084d43c292 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_delete_resource_guard_proxy_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_delete_resource_guard_proxy_requests.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/ResourceGuardCRUD/ListDeleteResourceGuardProxyRequests.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/ResourceGuardCRUD/ListDeleteResourceGuardProxyRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_disable_soft_delete_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_disable_soft_delete_requests.py index e9ea4e28e78d..eb62c946ce86 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_disable_soft_delete_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_disable_soft_delete_requests.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/ResourceGuardCRUD/ListDisableSoftDeleteRequests.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/ResourceGuardCRUD/ListDisableSoftDeleteRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_update_protected_item_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_update_protected_item_requests.py index 2a50e36c082b..03af0e5143c2 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_update_protected_item_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_update_protected_item_requests.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/ResourceGuardCRUD/ListUpdateProtectedItemRequests.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/ResourceGuardCRUD/ListUpdateProtectedItemRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_update_protection_policy_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_update_protection_policy_requests.py index 4df8c388fc0b..f5e50f1ad9cc 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_update_protection_policy_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_update_protection_policy_requests.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/ResourceGuardCRUD/ListUpdateProtectionPolicyRequests.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/ResourceGuardCRUD/ListUpdateProtectionPolicyRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/patch_resource_guard.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/patch_resource_guard.py index d856325644c5..df294559710a 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/patch_resource_guard.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/patch_resource_guard.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/ResourceGuardCRUD/PatchResourceGuard.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/ResourceGuardCRUD/PatchResourceGuard.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/put_resource_guard.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/put_resource_guard.py index 12eb5d92ccfc..2a4a167b0eec 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/put_resource_guard.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/put_resource_guard.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/ResourceGuardCRUD/PutResourceGuard.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/ResourceGuardCRUD/PutResourceGuard.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_proxy_crud/delete_resource_guard_proxy.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_proxy_crud/delete_resource_guard_proxy.py index d873f66d0e50..8a294d6b49c2 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_proxy_crud/delete_resource_guard_proxy.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_proxy_crud/delete_resource_guard_proxy.py @@ -36,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/ResourceGuardProxyCRUD/DeleteResourceGuardProxy.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/ResourceGuardProxyCRUD/DeleteResourceGuardProxy.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_proxy_crud/get_resource_guard_proxy.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_proxy_crud/get_resource_guard_proxy.py index 6e60178e41a5..27a609e57efb 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_proxy_crud/get_resource_guard_proxy.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_proxy_crud/get_resource_guard_proxy.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/ResourceGuardProxyCRUD/GetResourceGuardProxy.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/ResourceGuardProxyCRUD/GetResourceGuardProxy.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_proxy_crud/list_resource_guard_proxy.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_proxy_crud/list_resource_guard_proxy.py index d9c253fd416a..6695738e0daf 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_proxy_crud/list_resource_guard_proxy.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_proxy_crud/list_resource_guard_proxy.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/ResourceGuardProxyCRUD/ListResourceGuardProxy.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/ResourceGuardProxyCRUD/ListResourceGuardProxy.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_proxy_crud/put_resource_guard_proxy.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_proxy_crud/put_resource_guard_proxy.py index e963f35647bf..7b0dd52f1014 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_proxy_crud/put_resource_guard_proxy.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_proxy_crud/put_resource_guard_proxy.py @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/ResourceGuardProxyCRUD/PutResourceGuardProxy.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/ResourceGuardProxyCRUD/PutResourceGuardProxy.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_proxy_crud/unlock_delete_resource_guard_proxy.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_proxy_crud/unlock_delete_resource_guard_proxy.py index dcfb643ebab9..ddfb0cc73420 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_proxy_crud/unlock_delete_resource_guard_proxy.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_proxy_crud/unlock_delete_resource_guard_proxy.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/ResourceGuardProxyCRUD/UnlockDeleteResourceGuardProxy.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/ResourceGuardProxyCRUD/UnlockDeleteResourceGuardProxy.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/check_backup_vaults_name_availability.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/check_backup_vaults_name_availability.py index 6926835ef48d..71024faf0dc7 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/check_backup_vaults_name_availability.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/check_backup_vaults_name_availability.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/VaultCRUD/CheckBackupVaultsNameAvailability.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/VaultCRUD/CheckBackupVaultsNameAvailability.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/delete_backup_vault.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/delete_backup_vault.py index 68c66e32a77a..ae2f44bb13b7 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/delete_backup_vault.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/delete_backup_vault.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/VaultCRUD/DeleteBackupVault.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/VaultCRUD/DeleteBackupVault.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_backup_vault.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_backup_vault.py index 920be686e37b..90ac18bfd3af 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_backup_vault.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_backup_vault.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/VaultCRUD/GetBackupVault.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/VaultCRUD/GetBackupVault.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_backup_vault_with_msi.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_backup_vault_with_msi.py index 8a6baece5ef4..213cfddb1bdb 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_backup_vault_with_msi.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_backup_vault_with_msi.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/VaultCRUD/GetBackupVaultWithMSI.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/VaultCRUD/GetBackupVaultWithMSI.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_backup_vaults_in_resource_group.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_backup_vaults_in_resource_group.py index 4b6d946f8a99..67ea6e2027f7 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_backup_vaults_in_resource_group.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_backup_vaults_in_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/VaultCRUD/GetBackupVaultsInResourceGroup.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/VaultCRUD/GetBackupVaultsInResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_backup_vaults_in_subscription.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_backup_vaults_in_subscription.py index d038ae278bc4..56b518c859f4 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_backup_vaults_in_subscription.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_backup_vaults_in_subscription.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/VaultCRUD/GetBackupVaultsInSubscription.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/VaultCRUD/GetBackupVaultsInSubscription.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_operation_result_patch.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_operation_result_patch.py index c364950cc8aa..2687ff2b498d 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_operation_result_patch.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_operation_result_patch.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/VaultCRUD/GetOperationResultPatch.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/VaultCRUD/GetOperationResultPatch.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/patch_backup_vault.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/patch_backup_vault.py index 53c063d510cc..4ad68729e1e4 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/patch_backup_vault.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/patch_backup_vault.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/VaultCRUD/PatchBackupVault.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/VaultCRUD/PatchBackupVault.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/put_backup_vault.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/put_backup_vault.py index 3d3ecedf5d73..101d90a8aad0 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/put_backup_vault.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/put_backup_vault.py @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/VaultCRUD/PutBackupVault.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/VaultCRUD/PutBackupVault.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/put_backup_vault_with_msi.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/put_backup_vault_with_msi.py index eb578cf51894..202cc5eaa618 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/put_backup_vault_with_msi.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/put_backup_vault_with_msi.py @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/VaultCRUD/PutBackupVaultWithMSI.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2023-06-01-preview/examples/VaultCRUD/PutBackupVaultWithMSI.json if __name__ == "__main__": main()