From bf3ae0af6816f7b222880fdbbf4ceacfdc4f709c Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 13 Apr 2023 04:34:38 +0000 Subject: [PATCH] CodeGen from PR 23541 in Azure/azure-rest-api-specs Merge 0b4cf82c88438a682661435b99962d41cf41f10b into 5bcf0a7c3dbe04a6e8025735584943f5225ef508 --- .../azure-mgmt-dataprotection/_meta.json | 6 +- .../mgmt/dataprotection/_configuration.py | 10 +- .../_data_protection_mgmt_client.py | 11 +- .../mgmt/dataprotection/_serialization.py | 6 +- .../azure/mgmt/dataprotection/_version.py | 2 +- .../mgmt/dataprotection/aio/_configuration.py | 10 +- .../aio/_data_protection_mgmt_client.py | 11 +- .../dataprotection/aio/operations/__init__.py | 2 + .../_backup_instances_operations.py | 158 ++-- .../operations/_backup_policies_operations.py | 33 +- ...ckup_vault_operation_results_operations.py | 12 +- .../operations/_backup_vaults_operations.py | 66 +- .../operations/_data_protection_operations.py | 12 +- .../_data_protection_operations_operations.py | 12 +- .../_deleted_backup_instances_operations.py | 30 +- .../_dpp_resource_guard_proxy_operations.py | 607 ++++++++++++++ ...export_jobs_operation_result_operations.py | 12 +- .../aio/operations/_export_jobs_operations.py | 16 +- .../aio/operations/_jobs_operations.py | 19 +- .../_operation_result_operations.py | 12 +- ..._status_backup_vault_context_operations.py | 12 +- .../_operation_status_operations.py | 12 +- ...tatus_resource_group_context_operations.py | 12 +- .../operations/_recovery_points_operations.py | 19 +- .../operations/_resource_guards_operations.py | 151 ++-- .../_restorable_time_ranges_operations.py | 12 +- .../mgmt/dataprotection/models/__init__.py | 14 + .../mgmt/dataprotection/models/_models_py3.py | 290 ++++++- .../dataprotection/operations/__init__.py | 2 + .../_backup_instances_operations.py | 190 ++--- .../operations/_backup_policies_operations.py | 41 +- ...ckup_vault_operation_results_operations.py | 14 +- .../operations/_backup_vaults_operations.py | 80 +- .../operations/_data_protection_operations.py | 14 +- .../_data_protection_operations_operations.py | 14 +- .../_deleted_backup_instances_operations.py | 36 +- .../_dpp_resource_guard_proxy_operations.py | 784 ++++++++++++++++++ ...export_jobs_operation_result_operations.py | 14 +- .../operations/_export_jobs_operations.py | 18 +- .../operations/_jobs_operations.py | 23 +- .../_operation_result_operations.py | 14 +- ..._status_backup_vault_context_operations.py | 14 +- .../_operation_status_operations.py | 14 +- ...tatus_resource_group_context_operations.py | 14 +- .../operations/_recovery_points_operations.py | 23 +- .../operations/_resource_guards_operations.py | 217 +++-- .../_restorable_time_ranges_operations.py | 14 +- .../check_backup_vaults_name_availability.py | 2 +- .../generated_samples/checkfeature_support.py | 2 +- .../create_or_update_backup_policy.py | 2 +- .../delete_backup_instance.py | 2 +- .../generated_samples/delete_backup_policy.py | 2 +- .../generated_samples/delete_backup_vault.py | 2 +- .../delete_resource_guard.py | 2 +- .../delete_resource_guard_proxy.py | 42 + .../find_restorable_time_ranges.py | 2 +- .../generated_samples/get_backup_instance.py | 2 +- .../get_backup_instance_operation_result.py | 2 +- .../generated_samples/get_backup_policy.py | 2 +- .../generated_samples/get_backup_vault.py | 2 +- .../get_backup_vault_with_msi.py | 2 +- .../get_backup_vaults_in_resource_group.py | 2 +- .../get_backup_vaults_in_subscription.py | 2 +- ...et_default_backup_security_pin_requests.py | 2 +- ..._default_delete_protected_item_requests.py | 2 +- ...lt_delete_resource_guard_proxy_requests.py | 2 +- ...et_default_disable_soft_delete_requests.py | 2 +- ..._default_update_protected_item_requests.py | 2 +- ...fault_update_protection_policy_requests.py | 2 +- .../get_deleted_backup_instance.py | 2 +- .../get_export_jobs_operation_result.py | 2 +- .../generated_samples/get_job.py | 2 +- .../generated_samples/get_operation_result.py | 2 +- .../get_operation_result_patch.py | 2 +- .../generated_samples/get_operation_status.py | 2 +- .../get_operation_status_rg_context.py | 2 +- .../get_operation_status_vault_context.py | 2 +- .../generated_samples/get_recovery_point.py | 2 +- .../generated_samples/get_resource_guard.py | 2 +- .../get_resource_guard_proxy.py | 42 + .../get_resource_guards_in_resource_group.py | 2 +- .../get_resource_guards_in_subscription.py | 2 +- .../generated_samples/list.py | 2 +- .../list_backup_instances.py | 2 +- .../generated_samples/list_backup_policy.py | 2 +- .../list_backup_security_pin_requests.py | 2 +- .../list_delete_protected_item_requests.py | 2 +- ...st_delete_resource_guard_proxy_requests.py | 2 +- .../list_deleted_backup_instances.py | 2 +- .../list_disable_soft_delete_requests.py | 2 +- .../generated_samples/list_jobs.py | 2 +- .../generated_samples/list_recovery_points.py | 2 +- .../list_resource_guard_proxy.py | 42 + .../list_update_protected_item_requests.py | 2 +- .../list_update_protection_policy_requests.py | 2 +- .../generated_samples/patch_backup_vault.py | 2 +- .../generated_samples/patch_resource_guard.py | 2 +- .../generated_samples/put_backup_instance.py | 2 +- .../generated_samples/put_backup_vault.py | 2 +- .../put_backup_vault_with_msi.py | 2 +- .../generated_samples/put_resource_guard.py | 2 +- .../put_resource_guard_proxy.py | 47 ++ .../generated_samples/resume_backups.py | 2 +- .../generated_samples/resume_protection.py | 2 +- .../generated_samples/stop_protection.py | 2 +- .../generated_samples/suspend_backups.py | 2 +- .../generated_samples/sync_backup_instance.py | 2 +- .../generated_samples/trigger_backup.py | 2 +- .../generated_samples/trigger_export_jobs.py | 2 +- .../generated_samples/trigger_rehydrate.py | 2 +- .../generated_samples/trigger_restore.py | 2 +- .../trigger_restore_as_files.py | 2 +- .../trigger_restore_with_rehydration.py | 2 +- .../undelete_deleted_backup_instance.py | 2 +- .../unlock_delete_resource_guard_proxy.py | 48 ++ .../generated_samples/validate_for_backup.py | 2 +- .../generated_samples/validate_restore.py | 2 +- 117 files changed, 2497 insertions(+), 963 deletions(-) create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_dpp_resource_guard_proxy_operations.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_dpp_resource_guard_proxy_operations.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_resource_guard_proxy.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_resource_guard_proxy.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_resource_guard_proxy.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_resource_guard_proxy.py create mode 100644 sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/unlock_delete_resource_guard_proxy.py diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/_meta.json b/sdk/dataprotection/azure-mgmt-dataprotection/_meta.json index 8d7e363a7fc9..a08284d693a6 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/_meta.json +++ b/sdk/dataprotection/azure-mgmt-dataprotection/_meta.json @@ -1,11 +1,11 @@ { - "commit": "96c583e9d5d09c51fe8a21843180c51b98b4a7db", + "commit": "b59d8313c4711c523445222b046402347e8c549f", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.2", "use": [ - "@autorest/python@6.4.0", + "@autorest/python@6.4.8", "@autorest/modelerfour@4.24.3" ], - "autorest_command": "autorest specification/dataprotection/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.4.0 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/dataprotection/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.4.8 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", "readme": "specification/dataprotection/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_configuration.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_configuration.py index a6ddb97a5063..74d9acfeec0c 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_configuration.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from ._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -35,14 +29,14 @@ class DataProtectionMgmtClientConfiguration(Configuration): # pylint: disable=t :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-01-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2023-05-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(DataProtectionMgmtClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", "2023-01-01") + api_version: str = kwargs.pop("api_version", "2023-05-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_data_protection_mgmt_client.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_data_protection_mgmt_client.py index 04b5edb89829..a00da08653ec 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 @@ -23,6 +23,7 @@ DataProtectionOperations, DataProtectionOperationsOperations, DeletedBackupInstancesOperations, + DppResourceGuardProxyOperations, ExportJobsOperationResultOperations, ExportJobsOperations, JobsOperations, @@ -86,13 +87,16 @@ class DataProtectionMgmtClient: # pylint: disable=client-accepts-api-version-ke azure.mgmt.dataprotection.operations.DeletedBackupInstancesOperations :ivar resource_guards: ResourceGuardsOperations operations :vartype resource_guards: azure.mgmt.dataprotection.operations.ResourceGuardsOperations + :ivar dpp_resource_guard_proxy: DppResourceGuardProxyOperations operations + :vartype dpp_resource_guard_proxy: + azure.mgmt.dataprotection.operations.DppResourceGuardProxyOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2023-01-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2023-05-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no @@ -109,7 +113,7 @@ def __init__( self._config = DataProtectionMgmtClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -152,6 +156,9 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.resource_guards = ResourceGuardsOperations(self._client, self._config, self._serialize, self._deserialize) + self.dpp_resource_guard_proxy = DppResourceGuardProxyOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_serialization.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_serialization.py index f17c068e833e..842ae727fbbc 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_serialization.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_serialization.py @@ -629,7 +629,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if xml_desc.get("attr", False): if xml_ns: ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) serialized.set(xml_name, new_attr) # type: ignore continue if xml_desc.get("text", False): @@ -1271,7 +1271,7 @@ def _extract_name_from_internal_type(internal_type): xml_name = internal_type_xml_map.get("name", internal_type.__name__) xml_ns = internal_type_xml_map.get("ns", None) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) return xml_name @@ -1295,7 +1295,7 @@ def xml_key_extractor(attr, attr_desc, data): # Integrate namespace if necessary xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) # If it's an attribute, that's simple if xml_desc.get("attr", False): diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_version.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_version.py index c47f66669f1b..e5754a47ce68 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_version.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/_configuration.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/_configuration.py index 189b81274d68..763194804c29 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/_configuration.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from .._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -35,14 +29,14 @@ class DataProtectionMgmtClientConfiguration(Configuration): # pylint: disable=t :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-01-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2023-05-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(DataProtectionMgmtClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", "2023-01-01") + api_version: str = kwargs.pop("api_version", "2023-05-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/_data_protection_mgmt_client.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/_data_protection_mgmt_client.py index 8a67b75527b2..6b3517b1e691 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 @@ -23,6 +23,7 @@ DataProtectionOperations, DataProtectionOperationsOperations, DeletedBackupInstancesOperations, + DppResourceGuardProxyOperations, ExportJobsOperationResultOperations, ExportJobsOperations, JobsOperations, @@ -86,13 +87,16 @@ class DataProtectionMgmtClient: # pylint: disable=client-accepts-api-version-ke azure.mgmt.dataprotection.aio.operations.DeletedBackupInstancesOperations :ivar resource_guards: ResourceGuardsOperations operations :vartype resource_guards: azure.mgmt.dataprotection.aio.operations.ResourceGuardsOperations + :ivar dpp_resource_guard_proxy: DppResourceGuardProxyOperations operations + :vartype dpp_resource_guard_proxy: + azure.mgmt.dataprotection.aio.operations.DppResourceGuardProxyOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2023-01-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2023-05-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no @@ -109,7 +113,7 @@ def __init__( self._config = DataProtectionMgmtClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -152,6 +156,9 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.resource_guards = ResourceGuardsOperations(self._client, self._config, self._serialize, self._deserialize) + self.dpp_resource_guard_proxy = DppResourceGuardProxyOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/__init__.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/__init__.py index 6775e75af5a7..0bf84afef994 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 @@ -23,6 +23,7 @@ from ._export_jobs_operation_result_operations import ExportJobsOperationResultOperations from ._deleted_backup_instances_operations import DeletedBackupInstancesOperations from ._resource_guards_operations import ResourceGuardsOperations +from ._dpp_resource_guard_proxy_operations import DppResourceGuardProxyOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -46,6 +47,7 @@ "ExportJobsOperationResultOperations", "DeletedBackupInstancesOperations", "ResourceGuardsOperations", + "DppResourceGuardProxyOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_instances_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_instances_operations.py index 2578c16b4c71..0c74889f502f 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_instances_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_instances_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -49,10 +48,6 @@ build_validate_for_restore_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -97,9 +92,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BackupInstanceResourceList] = kwargs.pop("cls", None) error_map = { @@ -153,8 +146,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -199,9 +193,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BackupInstanceResource] = kwargs.pop("cls", None) request = build_get_request( @@ -217,8 +209,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -257,9 +250,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.BackupInstanceResource]] = kwargs.pop("cls", None) @@ -287,8 +278,9 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -441,9 +433,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BackupInstanceResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -503,9 +493,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -521,8 +509,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -574,9 +563,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -636,9 +623,7 @@ async def _adhoc_backup_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.OperationJobExtendedInfo]] = kwargs.pop("cls", None) @@ -666,8 +651,9 @@ async def _adhoc_backup_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -818,9 +804,7 @@ async def begin_adhoc_backup( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.OperationJobExtendedInfo] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -884,9 +868,7 @@ async def _validate_for_backup_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.OperationJobExtendedInfo]] = kwargs.pop("cls", None) @@ -913,8 +895,9 @@ async def _validate_for_backup_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1056,9 +1039,7 @@ async def begin_validate_for_backup( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.OperationJobExtendedInfo] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -1134,9 +1115,7 @@ async def get_backup_instance_operation_result( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Optional[_models.BackupInstanceResource]] = kwargs.pop("cls", None) request = build_get_backup_instance_operation_result_request( @@ -1153,8 +1132,9 @@ async def get_backup_instance_operation_result( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1195,9 +1175,7 @@ async def _trigger_rehydrate_initial( # pylint: disable=inconsistent-return-sta _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1225,8 +1203,9 @@ async def _trigger_rehydrate_initial( # pylint: disable=inconsistent-return-sta request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1365,9 +1344,7 @@ async def begin_trigger_rehydrate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -1430,9 +1407,7 @@ async def _trigger_restore_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.OperationJobExtendedInfo]] = kwargs.pop("cls", None) @@ -1460,8 +1435,9 @@ async def _trigger_restore_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1612,9 +1588,7 @@ async def begin_trigger_restore( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.OperationJobExtendedInfo] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -1674,9 +1648,7 @@ async def _resume_backups_initial( # pylint: disable=inconsistent-return-statem _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_resume_backups_request( @@ -1692,8 +1664,9 @@ async def _resume_backups_initial( # pylint: disable=inconsistent-return-statem request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1745,9 +1718,7 @@ async def begin_resume_backups( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -1802,9 +1773,7 @@ async def _resume_protection_initial( # pylint: disable=inconsistent-return-sta _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_resume_protection_request( @@ -1820,8 +1789,9 @@ async def _resume_protection_initial( # pylint: disable=inconsistent-return-sta request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1873,9 +1843,7 @@ async def begin_resume_protection( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -1930,9 +1898,7 @@ async def _stop_protection_initial( # pylint: disable=inconsistent-return-state _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_stop_protection_request( @@ -1948,8 +1914,9 @@ async def _stop_protection_initial( # pylint: disable=inconsistent-return-state request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2001,9 +1968,7 @@ async def begin_stop_protection( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -2058,9 +2023,7 @@ async def _suspend_backups_initial( # pylint: disable=inconsistent-return-state _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_suspend_backups_request( @@ -2076,8 +2039,9 @@ async def _suspend_backups_initial( # pylint: disable=inconsistent-return-state request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2130,9 +2094,7 @@ async def begin_suspend_backups( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -2192,9 +2154,7 @@ async def _sync_backup_instance_initial( # pylint: disable=inconsistent-return- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) @@ -2222,8 +2182,9 @@ async def _sync_backup_instance_initial( # pylint: disable=inconsistent-return- request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2365,9 +2326,7 @@ async def begin_sync_backup_instance( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -2430,9 +2389,7 @@ async def _validate_for_restore_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.OperationJobExtendedInfo]] = kwargs.pop("cls", None) @@ -2460,8 +2417,9 @@ async def _validate_for_restore_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2612,9 +2570,7 @@ async def begin_validate_for_restore( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.OperationJobExtendedInfo] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_policies_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_policies_operations.py index bed5e2b76031..70e4cd3ddf6e 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_policies_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_policies_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -36,10 +35,6 @@ build_list_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -84,9 +79,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BaseBackupPolicyResourceList] = kwargs.pop("cls", None) error_map = { @@ -140,8 +133,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -188,9 +182,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BaseBackupPolicyResource] = kwargs.pop("cls", None) request = build_get_request( @@ -206,8 +198,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -335,9 +328,7 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BaseBackupPolicyResource] = kwargs.pop("cls", None) @@ -365,8 +356,9 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -417,9 +409,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -435,8 +425,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_vault_operation_results_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_vault_operation_results_operations.py index 777308fa8277..45fc64bfb1ac 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_vault_operation_results_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_vault_operation_results_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from ..._vendor import _convert_request from ...operations._backup_vault_operation_results_operations import build_get_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -84,9 +79,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Optional[_models.BackupVaultResource]] = kwargs.pop("cls", None) request = build_get_request( @@ -102,8 +95,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_vaults_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_vaults_operations.py index 157173670396..7fbf85b44c74 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_vaults_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_vaults_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -41,10 +40,6 @@ build_update_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -81,9 +76,7 @@ def get_in_subscription(self, **kwargs: Any) -> AsyncIterable["_models.BackupVau _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BackupVaultResourceList] = kwargs.pop("cls", None) error_map = { @@ -135,8 +128,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -170,9 +164,7 @@ def get_in_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BackupVaultResourceList] = kwargs.pop("cls", None) error_map = { @@ -225,8 +217,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -267,9 +260,7 @@ async def get(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BackupVaultResource] = kwargs.pop("cls", None) request = build_get_request( @@ -284,8 +275,9 @@ async def get(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -323,9 +315,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BackupVaultResource] = kwargs.pop("cls", None) @@ -352,8 +342,9 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -489,9 +480,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BackupVaultResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -550,9 +539,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -567,8 +554,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -608,9 +596,7 @@ async def begin_delete(self, resource_group_name: str, vault_name: str, **kwargs _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -668,9 +654,7 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.BackupVaultResource]] = kwargs.pop("cls", None) @@ -697,8 +681,9 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -835,9 +820,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BackupVaultResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -981,9 +964,7 @@ async def check_name_availability( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.CheckNameAvailabilityResult] = kwargs.pop("cls", None) @@ -1010,8 +991,9 @@ async def check_name_availability( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_data_protection_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_data_protection_operations.py index 2585b302f9bf..72cd1e1f6483 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_data_protection_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_data_protection_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from ..._vendor import _convert_request from ...operations._data_protection_operations import build_check_feature_support_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -134,9 +129,7 @@ async def check_feature_support( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.FeatureValidationResponseBase] = kwargs.pop("cls", None) @@ -162,8 +155,9 @@ async def check_feature_support( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_data_protection_operations_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_data_protection_operations_operations.py index bec2f2a40495..345e0d4d1f75 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_data_protection_operations_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_data_protection_operations_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._data_protection_operations_operations import build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,9 +66,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ClientDiscoveryValueForS _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ClientDiscoveryResponse] = kwargs.pop("cls", None) error_map = { @@ -124,8 +117,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_deleted_backup_instances_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_deleted_backup_instances_operations.py index 8a40199d93c5..1cc65d1f39c8 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_deleted_backup_instances_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_deleted_backup_instances_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast import urllib.parse @@ -37,10 +36,6 @@ build_undelete_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -85,9 +80,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DeletedBackupInstanceResourceList] = kwargs.pop("cls", None) error_map = { @@ -141,8 +134,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -187,9 +181,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DeletedBackupInstanceResource] = kwargs.pop("cls", None) request = build_get_request( @@ -205,8 +197,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -240,9 +233,7 @@ async def _undelete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_undelete_request( @@ -258,8 +249,9 @@ async def _undelete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -303,9 +295,7 @@ async def begin_undelete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_dpp_resource_guard_proxy_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_dpp_resource_guard_proxy_operations.py new file mode 100644 index 000000000000..531256cd7f48 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_dpp_resource_guard_proxy_operations.py @@ -0,0 +1,607 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._dpp_resource_guard_proxy_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, + build_unlock_delete_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class DppResourceGuardProxyOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.dataprotection.aio.DataProtectionMgmtClient`'s + :attr:`dpp_resource_guard_proxy` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, vault_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ResourceGuardProxyBaseResource"]: + """Returns the list of ResourceGuardProxies associated with the vault. + + Returns the list of ResourceGuardProxies associated with the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceGuardProxyBaseResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ResourceGuardProxyBaseResourceList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ResourceGuardProxyBaseResourceList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, vault_name: str, resource_guard_proxy_name: str, **kwargs: Any + ) -> _models.ResourceGuardProxyBaseResource: + """Returns the ResourceGuardProxy object associated with the vault, and that matches the name in + the request. + + Returns the ResourceGuardProxy object associated with the vault, and that matches the name in + the request. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param resource_guard_proxy_name: name of the resource guard proxy. Required. + :type resource_guard_proxy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceGuardProxyBaseResource or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ResourceGuardProxyBaseResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + resource_guard_proxy_name=resource_guard_proxy_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ResourceGuardProxyBaseResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + vault_name: str, + resource_guard_proxy_name: str, + parameters: _models.ResourceGuardProxyBaseResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ResourceGuardProxyBaseResource: + """Creates or Updates a ResourceGuardProxy. + + Creates or Updates a ResourceGuardProxy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param resource_guard_proxy_name: name of the resource guard proxy. Required. + :type resource_guard_proxy_name: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceGuardProxyBaseResource or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + vault_name: str, + resource_guard_proxy_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ResourceGuardProxyBaseResource: + """Creates or Updates a ResourceGuardProxy. + + Creates or Updates a ResourceGuardProxy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param resource_guard_proxy_name: name of the resource guard proxy. Required. + :type resource_guard_proxy_name: str + :param parameters: Request body for operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceGuardProxyBaseResource or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + vault_name: str, + resource_guard_proxy_name: str, + parameters: Union[_models.ResourceGuardProxyBaseResource, IO], + **kwargs: Any + ) -> _models.ResourceGuardProxyBaseResource: + """Creates or Updates a ResourceGuardProxy. + + Creates or Updates a ResourceGuardProxy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param resource_guard_proxy_name: name of the resource guard proxy. Required. + :type resource_guard_proxy_name: str + :param parameters: Request body for operation. Is either a ResourceGuardProxyBaseResource type + or a IO type. Required. + :type parameters: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceGuardProxyBaseResource or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ResourceGuardProxyBaseResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ResourceGuardProxyBaseResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + resource_guard_proxy_name=resource_guard_proxy_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ResourceGuardProxyBaseResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, vault_name: str, resource_guard_proxy_name: str, **kwargs: Any + ) -> None: + """Deletes the ResourceGuardProxy. + + Deletes the ResourceGuardProxy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param resource_guard_proxy_name: name of the resource guard proxy. Required. + :type resource_guard_proxy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + resource_guard_proxy_name=resource_guard_proxy_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}" + } + + @overload + async def unlock_delete( + self, + resource_group_name: str, + vault_name: str, + resource_guard_proxy_name: str, + parameters: _models.UnlockDeleteRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.UnlockDeleteResponse: + """UnlockDelete call for ResourceGuardProxy, executed before one can delete it. + + UnlockDelete call for ResourceGuardProxy, executed before one can delete it. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param resource_guard_proxy_name: name of the resource guard proxy. Required. + :type resource_guard_proxy_name: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.UnlockDeleteRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: UnlockDeleteResponse or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.UnlockDeleteResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def unlock_delete( + self, + resource_group_name: str, + vault_name: str, + resource_guard_proxy_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.UnlockDeleteResponse: + """UnlockDelete call for ResourceGuardProxy, executed before one can delete it. + + UnlockDelete call for ResourceGuardProxy, executed before one can delete it. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param resource_guard_proxy_name: name of the resource guard proxy. Required. + :type resource_guard_proxy_name: str + :param parameters: Request body for operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: UnlockDeleteResponse or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.UnlockDeleteResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def unlock_delete( + self, + resource_group_name: str, + vault_name: str, + resource_guard_proxy_name: str, + parameters: Union[_models.UnlockDeleteRequest, IO], + **kwargs: Any + ) -> _models.UnlockDeleteResponse: + """UnlockDelete call for ResourceGuardProxy, executed before one can delete it. + + UnlockDelete call for ResourceGuardProxy, executed before one can delete it. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param resource_guard_proxy_name: name of the resource guard proxy. Required. + :type resource_guard_proxy_name: str + :param parameters: Request body for operation. Is either a UnlockDeleteRequest type or a IO + type. Required. + :type parameters: ~azure.mgmt.dataprotection.models.UnlockDeleteRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: UnlockDeleteResponse or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.UnlockDeleteResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.UnlockDeleteResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "UnlockDeleteRequest") + + request = build_unlock_delete_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + resource_guard_proxy_name=resource_guard_proxy_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.unlock_delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("UnlockDeleteResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + unlock_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}/unlockDelete" + } diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_export_jobs_operation_result_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_export_jobs_operation_result_operations.py index 357aef650008..ebe41aa48e6b 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_export_jobs_operation_result_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_export_jobs_operation_result_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from ..._vendor import _convert_request from ...operations._export_jobs_operation_result_operations import build_get_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -86,9 +81,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Optional[_models.ExportJobsResult]] = kwargs.pop("cls", None) request = build_get_request( @@ -104,8 +97,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_export_jobs_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_export_jobs_operations.py index cea189a02943..014d94bbc1d4 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_export_jobs_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_export_jobs_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.exceptions import ( @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._export_jobs_operations import build_trigger_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,9 +66,7 @@ async def _trigger_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_trigger_request( @@ -88,8 +81,9 @@ async def _trigger_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -134,9 +128,7 @@ async def begin_trigger(self, resource_group_name: str, vault_name: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_jobs_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_jobs_operations.py index 4ad45fe60b57..2a959e7644e1 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_jobs_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_jobs_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -31,10 +30,6 @@ from ..._vendor import _convert_request from ...operations._jobs_operations import build_get_request, build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -79,9 +74,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AzureBackupJobResourceList] = kwargs.pop("cls", None) error_map = { @@ -135,8 +128,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -182,9 +176,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AzureBackupJobResource] = kwargs.pop("cls", None) request = build_get_request( @@ -200,8 +192,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_result_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_result_operations.py index 6ee4c3d2c46f..ca45f75b3e43 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_result_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_result_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from ..._vendor import _convert_request from ...operations._operation_result_operations import build_get_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -81,9 +76,7 @@ async def get(self, operation_id: str, location: str, **kwargs: Any) -> Optional _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Optional[_models.OperationJobExtendedInfo]] = kwargs.pop("cls", None) request = build_get_request( @@ -98,8 +91,9 @@ async def get(self, operation_id: str, location: str, **kwargs: Any) -> Optional request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_status_backup_vault_context_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_status_backup_vault_context_operations.py index 2021abed1c32..b63ed87f7efd 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_status_backup_vault_context_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_status_backup_vault_context_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from ..._vendor import _convert_request from ...operations._operation_status_backup_vault_context_operations import build_get_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -86,9 +81,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationResource] = kwargs.pop("cls", None) request = build_get_request( @@ -104,8 +97,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_status_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_status_operations.py index e6fd595bb966..1f2a9ff2d137 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_status_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_status_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from ..._vendor import _convert_request from ...operations._operation_status_operations import build_get_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -81,9 +76,7 @@ async def get(self, location: str, operation_id: str, **kwargs: Any) -> _models. _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationResource] = kwargs.pop("cls", None) request = build_get_request( @@ -98,8 +91,9 @@ async def get(self, location: str, operation_id: str, **kwargs: Any) -> _models. request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_status_resource_group_context_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_status_resource_group_context_operations.py index 35fee05cd48b..c88e1e728c2e 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_status_resource_group_context_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_status_resource_group_context_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from ..._vendor import _convert_request from ...operations._operation_status_resource_group_context_operations import build_get_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -82,9 +77,7 @@ async def get(self, resource_group_name: str, operation_id: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationResource] = kwargs.pop("cls", None) request = build_get_request( @@ -99,8 +92,9 @@ async def get(self, resource_group_name: str, operation_id: str, **kwargs: Any) request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_recovery_points_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_recovery_points_operations.py index fd451be378c5..3b50b18e7750 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_recovery_points_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_recovery_points_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -31,10 +30,6 @@ from ..._vendor import _convert_request from ...operations._recovery_points_operations import build_get_request, build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -91,9 +86,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AzureBackupRecoveryPointResourceList] = kwargs.pop("cls", None) error_map = { @@ -150,8 +143,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -203,9 +197,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AzureBackupRecoveryPointResource] = kwargs.pop("cls", None) request = build_get_request( @@ -222,8 +214,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_resource_guards_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_resource_guards_operations.py index 984a8a9f6957..38ca417045c0 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_resource_guards_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_resource_guards_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -50,10 +49,6 @@ build_put_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -93,9 +88,7 @@ def get_resources_in_subscription(self, **kwargs: Any) -> AsyncIterable["_models _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ResourceGuardResourceList] = kwargs.pop("cls", None) error_map = { @@ -147,8 +140,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -185,9 +179,7 @@ def get_resources_in_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ResourceGuardResourceList] = kwargs.pop("cls", None) error_map = { @@ -240,8 +232,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -356,9 +349,7 @@ async def put( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ResourceGuardResource] = kwargs.pop("cls", None) @@ -385,8 +376,9 @@ async def put( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -439,9 +431,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ResourceGuardResource] = kwargs.pop("cls", None) request = build_get_request( @@ -456,8 +446,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -506,9 +497,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -523,8 +512,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -645,9 +635,7 @@ async def patch( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ResourceGuardResource] = kwargs.pop("cls", None) @@ -674,8 +662,9 @@ async def patch( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -719,9 +708,7 @@ def get_disable_soft_delete_requests_objects( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DppBaseResourceList] = kwargs.pop("cls", None) error_map = { @@ -775,8 +762,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -793,7 +781,7 @@ async def get_next(next_link=None): } @distributed_trace - def get_delete_resource_guard_proxy_requests_objects( + def get_delete_resource_guard_proxy_requests_objects( # pylint: disable=name-too-long self, resource_group_name: str, resource_guards_name: str, **kwargs: Any ) -> AsyncIterable["_models.DppBaseResource"]: """Returns collection of operation request objects for a critical operation protected by the given @@ -816,9 +804,7 @@ def get_delete_resource_guard_proxy_requests_objects( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DppBaseResourceList] = kwargs.pop("cls", None) error_map = { @@ -872,8 +858,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -913,9 +900,7 @@ def get_backup_security_pin_requests_objects( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DppBaseResourceList] = kwargs.pop("cls", None) error_map = { @@ -969,8 +954,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -987,7 +973,7 @@ async def get_next(next_link=None): } @distributed_trace - def get_delete_protected_item_requests_objects( + def get_delete_protected_item_requests_objects( # pylint: disable=name-too-long self, resource_group_name: str, resource_guards_name: str, **kwargs: Any ) -> AsyncIterable["_models.DppBaseResource"]: """Returns collection of operation request objects for a critical operation protected by the given @@ -1010,9 +996,7 @@ def get_delete_protected_item_requests_objects( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DppBaseResourceList] = kwargs.pop("cls", None) error_map = { @@ -1066,8 +1050,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1084,7 +1069,7 @@ async def get_next(next_link=None): } @distributed_trace - def get_update_protection_policy_requests_objects( + def get_update_protection_policy_requests_objects( # pylint: disable=name-too-long self, resource_group_name: str, resource_guards_name: str, **kwargs: Any ) -> AsyncIterable["_models.DppBaseResource"]: """Returns collection of operation request objects for a critical operation protected by the given @@ -1107,9 +1092,7 @@ def get_update_protection_policy_requests_objects( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DppBaseResourceList] = kwargs.pop("cls", None) error_map = { @@ -1163,8 +1146,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1181,7 +1165,7 @@ async def get_next(next_link=None): } @distributed_trace - def get_update_protected_item_requests_objects( + def get_update_protected_item_requests_objects( # pylint: disable=name-too-long self, resource_group_name: str, resource_guards_name: str, **kwargs: Any ) -> AsyncIterable["_models.DppBaseResource"]: """Returns collection of operation request objects for a critical operation protected by the given @@ -1204,9 +1188,7 @@ def get_update_protected_item_requests_objects( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DppBaseResourceList] = kwargs.pop("cls", None) error_map = { @@ -1260,8 +1242,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1278,7 +1261,7 @@ async def get_next(next_link=None): } @distributed_trace_async - async def get_default_disable_soft_delete_requests_object( + async def get_default_disable_soft_delete_requests_object( # pylint: disable=name-too-long self, resource_group_name: str, resource_guards_name: str, request_name: str, **kwargs: Any ) -> _models.DppBaseResource: """Returns collection of operation request objects for a critical operation protected by the given @@ -1310,9 +1293,7 @@ async def get_default_disable_soft_delete_requests_object( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) request = build_get_default_disable_soft_delete_requests_object_request( @@ -1328,8 +1309,9 @@ async def get_default_disable_soft_delete_requests_object( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1350,7 +1332,7 @@ async def get_default_disable_soft_delete_requests_object( } @distributed_trace_async - async def get_default_delete_resource_guard_proxy_requests_object( + async def get_default_delete_resource_guard_proxy_requests_object( # pylint: disable=name-too-long self, resource_group_name: str, resource_guards_name: str, request_name: str, **kwargs: Any ) -> _models.DppBaseResource: """Returns collection of operation request objects for a critical operation protected by the given @@ -1382,9 +1364,7 @@ async def get_default_delete_resource_guard_proxy_requests_object( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) request = build_get_default_delete_resource_guard_proxy_requests_object_request( @@ -1400,8 +1380,9 @@ async def get_default_delete_resource_guard_proxy_requests_object( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1422,7 +1403,7 @@ async def get_default_delete_resource_guard_proxy_requests_object( } @distributed_trace_async - async def get_default_backup_security_pin_requests_object( + async def get_default_backup_security_pin_requests_object( # pylint: disable=name-too-long self, resource_group_name: str, resource_guards_name: str, request_name: str, **kwargs: Any ) -> _models.DppBaseResource: """Returns collection of operation request objects for a critical operation protected by the given @@ -1454,9 +1435,7 @@ async def get_default_backup_security_pin_requests_object( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) request = build_get_default_backup_security_pin_requests_object_request( @@ -1472,8 +1451,9 @@ async def get_default_backup_security_pin_requests_object( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1494,7 +1474,7 @@ async def get_default_backup_security_pin_requests_object( } @distributed_trace_async - async def get_default_delete_protected_item_requests_object( + async def get_default_delete_protected_item_requests_object( # pylint: disable=name-too-long self, resource_group_name: str, resource_guards_name: str, request_name: str, **kwargs: Any ) -> _models.DppBaseResource: """Returns collection of operation request objects for a critical operation protected by the given @@ -1526,9 +1506,7 @@ async def get_default_delete_protected_item_requests_object( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) request = build_get_default_delete_protected_item_requests_object_request( @@ -1544,8 +1522,9 @@ async def get_default_delete_protected_item_requests_object( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1566,7 +1545,7 @@ async def get_default_delete_protected_item_requests_object( } @distributed_trace_async - async def get_default_update_protection_policy_requests_object( + async def get_default_update_protection_policy_requests_object( # pylint: disable=name-too-long self, resource_group_name: str, resource_guards_name: str, request_name: str, **kwargs: Any ) -> _models.DppBaseResource: """Returns collection of operation request objects for a critical operation protected by the given @@ -1598,9 +1577,7 @@ async def get_default_update_protection_policy_requests_object( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) request = build_get_default_update_protection_policy_requests_object_request( @@ -1616,8 +1593,9 @@ async def get_default_update_protection_policy_requests_object( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1638,7 +1616,7 @@ async def get_default_update_protection_policy_requests_object( } @distributed_trace_async - async def get_default_update_protected_item_requests_object( + async def get_default_update_protected_item_requests_object( # pylint: disable=name-too-long self, resource_group_name: str, resource_guards_name: str, request_name: str, **kwargs: Any ) -> _models.DppBaseResource: """Returns collection of operation request objects for a critical operation protected by the given @@ -1670,9 +1648,7 @@ async def get_default_update_protected_item_requests_object( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) request = build_get_default_update_protected_item_requests_object_request( @@ -1688,8 +1664,9 @@ async def get_default_update_protected_item_requests_object( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_restorable_time_ranges_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_restorable_time_ranges_operations.py index f9eafa86c2d3..79a6065e3fc5 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_restorable_time_ranges_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_restorable_time_ranges_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from ..._vendor import _convert_request from ...operations._restorable_time_ranges_operations import build_find_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -158,9 +153,7 @@ async def find( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AzureBackupFindRestorableTimeRangesResponseResource] = kwargs.pop("cls", None) @@ -188,8 +181,9 @@ async def find( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/__init__.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/__init__.py index 68927a1a9dad..f08275442e54 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 @@ -102,6 +102,7 @@ from ._models_py3 import KubernetesPVRestoreCriteria from ._models_py3 import KubernetesStorageClassRestoreCriteria from ._models_py3 import MonitoringSettings +from ._models_py3 import NamespacedNameResource from ._models_py3 import OperationExtendedInfo from ._models_py3 import OperationJobExtendedInfo from ._models_py3 import OperationResource @@ -116,6 +117,10 @@ from ._models_py3 import RecoveryPointsFilters from ._models_py3 import ResourceGuard from ._models_py3 import ResourceGuardOperation +from ._models_py3 import ResourceGuardOperationDetail +from ._models_py3 import ResourceGuardProxyBase +from ._models_py3 import ResourceGuardProxyBaseResource +from ._models_py3 import ResourceGuardProxyBaseResourceList from ._models_py3 import ResourceGuardResource from ._models_py3 import ResourceGuardResourceList from ._models_py3 import ResourceMoveDetails @@ -141,6 +146,8 @@ from ._models_py3 import TargetDetails from ._models_py3 import TriggerBackupRequest from ._models_py3 import TriggerContext +from ._models_py3 import UnlockDeleteRequest +from ._models_py3 import UnlockDeleteResponse from ._models_py3 import UserFacingError from ._models_py3 import ValidateForBackupRequest from ._models_py3 import ValidateRestoreRequestObject @@ -275,6 +282,7 @@ "KubernetesPVRestoreCriteria", "KubernetesStorageClassRestoreCriteria", "MonitoringSettings", + "NamespacedNameResource", "OperationExtendedInfo", "OperationJobExtendedInfo", "OperationResource", @@ -289,6 +297,10 @@ "RecoveryPointsFilters", "ResourceGuard", "ResourceGuardOperation", + "ResourceGuardOperationDetail", + "ResourceGuardProxyBase", + "ResourceGuardProxyBaseResource", + "ResourceGuardProxyBaseResourceList", "ResourceGuardResource", "ResourceGuardResourceList", "ResourceMoveDetails", @@ -314,6 +326,8 @@ "TargetDetails", "TriggerBackupRequest", "TriggerContext", + "UnlockDeleteRequest", + "UnlockDeleteResponse", "UserFacingError", "ValidateForBackupRequest", "ValidateRestoreRequestObject", diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/_models_py3.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/_models_py3.py index adddde516415..fc332953bcaf 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 @@ -4264,26 +4264,29 @@ class KubernetesClusterBackupDatasourceParameters(BackupDatasourceParameters): :ivar object_type: Type of the specific object - used for deserializing. Required. :vartype object_type: str :ivar snapshot_volumes: Gets or sets the volume snapshot property. This property if enabled - will take volume snapshots during restore. Required. + will take volume snapshots during backup. Required. :vartype snapshot_volumes: bool :ivar include_cluster_scope_resources: Gets or sets the include cluster resources property. - This property if enabled will include cluster scope resources during restore. Required. + This property if enabled will include cluster scope resources during backup. Required. :vartype include_cluster_scope_resources: bool :ivar included_namespaces: Gets or sets the include namespaces property. This property sets the - namespaces to be included during restore. + namespaces to be included during backup. :vartype included_namespaces: list[str] :ivar excluded_namespaces: Gets or sets the exclude namespaces property. This property sets the - namespaces to be excluded during restore. + namespaces to be excluded during backup. :vartype excluded_namespaces: list[str] :ivar included_resource_types: Gets or sets the include resource types property. This property - sets the resource types to be included during restore. + sets the resource types to be included during backup. :vartype included_resource_types: list[str] :ivar excluded_resource_types: Gets or sets the exclude resource types property. This property - sets the resource types to be excluded during restore. + sets the resource types to be excluded during backup. :vartype excluded_resource_types: list[str] :ivar label_selectors: Gets or sets the LabelSelectors property. This property sets the - resource with such label selectors to be included during restore. + resource with such label selectors to be included during backup. :vartype label_selectors: list[str] + :ivar backup_hook_references: Gets or sets the backup hook references. This property sets the + hook reference to be executed during backup. + :vartype backup_hook_references: list[~azure.mgmt.dataprotection.models.NamespacedNameResource] """ _validation = { @@ -4301,6 +4304,7 @@ class KubernetesClusterBackupDatasourceParameters(BackupDatasourceParameters): "included_resource_types": {"key": "includedResourceTypes", "type": "[str]"}, "excluded_resource_types": {"key": "excludedResourceTypes", "type": "[str]"}, "label_selectors": {"key": "labelSelectors", "type": "[str]"}, + "backup_hook_references": {"key": "backupHookReferences", "type": "[NamespacedNameResource]"}, } def __init__( @@ -4313,30 +4317,35 @@ def __init__( included_resource_types: Optional[List[str]] = None, excluded_resource_types: Optional[List[str]] = None, label_selectors: Optional[List[str]] = None, + backup_hook_references: Optional[List["_models.NamespacedNameResource"]] = None, **kwargs: Any ) -> None: """ :keyword snapshot_volumes: Gets or sets the volume snapshot property. This property if enabled - will take volume snapshots during restore. Required. + will take volume snapshots during backup. Required. :paramtype snapshot_volumes: bool :keyword include_cluster_scope_resources: Gets or sets the include cluster resources property. - This property if enabled will include cluster scope resources during restore. Required. + This property if enabled will include cluster scope resources during backup. Required. :paramtype include_cluster_scope_resources: bool :keyword included_namespaces: Gets or sets the include namespaces property. This property sets - the namespaces to be included during restore. + the namespaces to be included during backup. :paramtype included_namespaces: list[str] :keyword excluded_namespaces: Gets or sets the exclude namespaces property. This property sets - the namespaces to be excluded during restore. + the namespaces to be excluded during backup. :paramtype excluded_namespaces: list[str] :keyword included_resource_types: Gets or sets the include resource types property. This - property sets the resource types to be included during restore. + property sets the resource types to be included during backup. :paramtype included_resource_types: list[str] :keyword excluded_resource_types: Gets or sets the exclude resource types property. This - property sets the resource types to be excluded during restore. + property sets the resource types to be excluded during backup. :paramtype excluded_resource_types: list[str] :keyword label_selectors: Gets or sets the LabelSelectors property. This property sets the - resource with such label selectors to be included during restore. + resource with such label selectors to be included during backup. :paramtype label_selectors: list[str] + :keyword backup_hook_references: Gets or sets the backup hook references. This property sets + the hook reference to be executed during backup. + :paramtype backup_hook_references: + list[~azure.mgmt.dataprotection.models.NamespacedNameResource] """ super().__init__(**kwargs) self.object_type: str = "KubernetesClusterBackupDatasourceParameters" @@ -4347,9 +4356,10 @@ def __init__( self.included_resource_types = included_resource_types self.excluded_resource_types = excluded_resource_types self.label_selectors = label_selectors + self.backup_hook_references = backup_hook_references -class KubernetesClusterRestoreCriteria(ItemLevelRestoreCriteria): +class KubernetesClusterRestoreCriteria(ItemLevelRestoreCriteria): # pylint: disable=too-many-instance-attributes """kubernetes Cluster Backup target info for restore operation. All required parameters must be populated in order to send to Azure. @@ -4385,6 +4395,10 @@ class KubernetesClusterRestoreCriteria(ItemLevelRestoreCriteria): :ivar namespace_mappings: Gets or sets the Namespace Mappings property. This property sets if namespace needs to be change during restore. :vartype namespace_mappings: dict[str, str] + :ivar restore_hook_references: Gets or sets the restore hook references. This property sets the + hook reference to be executed during restore. + :vartype restore_hook_references: + list[~azure.mgmt.dataprotection.models.NamespacedNameResource] """ _validation = { @@ -4403,6 +4417,7 @@ class KubernetesClusterRestoreCriteria(ItemLevelRestoreCriteria): "persistent_volume_restore_mode": {"key": "persistentVolumeRestoreMode", "type": "str"}, "conflict_policy": {"key": "conflictPolicy", "type": "str"}, "namespace_mappings": {"key": "namespaceMappings", "type": "{str}"}, + "restore_hook_references": {"key": "restoreHookReferences", "type": "[NamespacedNameResource]"}, } def __init__( @@ -4417,6 +4432,7 @@ def __init__( persistent_volume_restore_mode: Optional[Union[str, "_models.PersistentVolumeRestoreMode"]] = None, conflict_policy: Optional[Union[str, "_models.ExistingResourcePolicy"]] = None, namespace_mappings: Optional[Dict[str, str]] = None, + restore_hook_references: Optional[List["_models.NamespacedNameResource"]] = None, **kwargs: Any ) -> None: """ @@ -4449,6 +4465,10 @@ def __init__( :keyword namespace_mappings: Gets or sets the Namespace Mappings property. This property sets if namespace needs to be change during restore. :paramtype namespace_mappings: dict[str, str] + :keyword restore_hook_references: Gets or sets the restore hook references. This property sets + the hook reference to be executed during restore. + :paramtype restore_hook_references: + list[~azure.mgmt.dataprotection.models.NamespacedNameResource] """ super().__init__(**kwargs) self.object_type: str = "KubernetesClusterRestoreCriteria" @@ -4461,6 +4481,7 @@ def __init__( self.persistent_volume_restore_mode = persistent_volume_restore_mode self.conflict_policy = conflict_policy self.namespace_mappings = namespace_mappings + self.restore_hook_references = restore_hook_references class KubernetesPVRestoreCriteria(ItemLevelRestoreCriteria): @@ -4561,6 +4582,32 @@ def __init__( self.azure_monitor_alert_settings = azure_monitor_alert_settings +class NamespacedNameResource(_serialization.Model): + """Class to refer resources which contains namespace and name. + + :ivar name: Name of the resource. + :vartype name: str + :ivar namespace: Namespace in which the resource exists. + :vartype namespace: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + } + + def __init__(self, *, name: Optional[str] = None, namespace: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword name: Name of the resource. + :paramtype name: str + :keyword namespace: Namespace in which the resource exists. + :paramtype namespace: str + """ + super().__init__(**kwargs) + self.name = name + self.namespace = namespace + + class OperationExtendedInfo(_serialization.Model): """Operation Extended Info. @@ -5169,6 +5216,165 @@ def __init__(self, **kwargs: Any) -> None: self.request_resource_type = None +class ResourceGuardOperationDetail(_serialization.Model): + """VaultCritical Operation protected by a resource guard. + + :ivar vault_critical_operation: + :vartype vault_critical_operation: str + :ivar default_resource_request: + :vartype default_resource_request: str + """ + + _attribute_map = { + "vault_critical_operation": {"key": "vaultCriticalOperation", "type": "str"}, + "default_resource_request": {"key": "defaultResourceRequest", "type": "str"}, + } + + def __init__( + self, + *, + vault_critical_operation: Optional[str] = None, + default_resource_request: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword vault_critical_operation: + :paramtype vault_critical_operation: str + :keyword default_resource_request: + :paramtype default_resource_request: str + """ + super().__init__(**kwargs) + self.vault_critical_operation = vault_critical_operation + self.default_resource_request = default_resource_request + + +class ResourceGuardProxyBase(_serialization.Model): + """ResourceGuardProxyBase object, used in ResourceGuardProxyBaseResource. + + :ivar resource_guard_resource_id: + :vartype resource_guard_resource_id: str + :ivar resource_guard_operation_details: + :vartype resource_guard_operation_details: + list[~azure.mgmt.dataprotection.models.ResourceGuardOperationDetail] + :ivar last_updated_time: + :vartype last_updated_time: str + :ivar description: + :vartype description: str + """ + + _attribute_map = { + "resource_guard_resource_id": {"key": "resourceGuardResourceId", "type": "str"}, + "resource_guard_operation_details": { + "key": "resourceGuardOperationDetails", + "type": "[ResourceGuardOperationDetail]", + }, + "last_updated_time": {"key": "lastUpdatedTime", "type": "str"}, + "description": {"key": "description", "type": "str"}, + } + + def __init__( + self, + *, + resource_guard_resource_id: Optional[str] = None, + resource_guard_operation_details: Optional[List["_models.ResourceGuardOperationDetail"]] = None, + last_updated_time: Optional[str] = None, + description: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword resource_guard_resource_id: + :paramtype resource_guard_resource_id: str + :keyword resource_guard_operation_details: + :paramtype resource_guard_operation_details: + list[~azure.mgmt.dataprotection.models.ResourceGuardOperationDetail] + :keyword last_updated_time: + :paramtype last_updated_time: str + :keyword description: + :paramtype description: str + """ + super().__init__(**kwargs) + self.resource_guard_resource_id = resource_guard_resource_id + self.resource_guard_operation_details = resource_guard_operation_details + self.last_updated_time = last_updated_time + self.description = description + + +class ResourceGuardProxyBaseResource(DppResource): + """ResourceGuardProxyBaseResource object, used for response and request bodies for + ResourceGuardProxy APIs. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id represents the complete path to the resource. + :vartype id: str + :ivar name: Resource name associated with the resource. + :vartype name: str + :ivar type: Resource type represents the complete path of the form + Namespace/ResourceType/ResourceType/... + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.dataprotection.models.SystemData + :ivar properties: ResourceGuardProxyBaseResource properties. + :vartype properties: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBase + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "properties": {"key": "properties", "type": "ResourceGuardProxyBase"}, + } + + def __init__(self, *, properties: Optional["_models.ResourceGuardProxyBase"] = None, **kwargs: Any) -> None: + """ + :keyword properties: ResourceGuardProxyBaseResource properties. + :paramtype properties: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBase + """ + super().__init__(**kwargs) + self.properties = properties + + +class ResourceGuardProxyBaseResourceList(DppResourceList): + """List of ResourceGuardProxyBase resources. + + :ivar next_link: The uri to fetch the next page of resources. Call ListNext() fetches next page + of resources. + :vartype next_link: str + :ivar value: List of resources. + :vartype value: list[~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource] + """ + + _attribute_map = { + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[ResourceGuardProxyBaseResource]"}, + } + + def __init__( + self, + *, + next_link: Optional[str] = None, + value: Optional[List["_models.ResourceGuardProxyBaseResource"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword next_link: The uri to fetch the next page of resources. Call ListNext() fetches next + page of resources. + :paramtype next_link: str + :keyword value: List of resources. + :paramtype value: list[~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource] + """ + super().__init__(next_link=next_link, **kwargs) + self.value = value + + class ResourceGuardResource(DppBaseTrackedResource): """ResourceGuardResource. @@ -6213,6 +6419,60 @@ def __init__(self, *, backup_rule_options: "_models.AdHocBackupRuleOptions", **k self.backup_rule_options = backup_rule_options +class UnlockDeleteRequest(_serialization.Model): + """Request body of unlock delete API. + + :ivar resource_guard_operation_requests: + :vartype resource_guard_operation_requests: list[str] + :ivar resource_to_be_deleted: + :vartype resource_to_be_deleted: str + """ + + _attribute_map = { + "resource_guard_operation_requests": {"key": "resourceGuardOperationRequests", "type": "[str]"}, + "resource_to_be_deleted": {"key": "resourceToBeDeleted", "type": "str"}, + } + + def __init__( + self, + *, + resource_guard_operation_requests: Optional[List[str]] = None, + resource_to_be_deleted: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword resource_guard_operation_requests: + :paramtype resource_guard_operation_requests: list[str] + :keyword resource_to_be_deleted: + :paramtype resource_to_be_deleted: str + """ + super().__init__(**kwargs) + self.resource_guard_operation_requests = resource_guard_operation_requests + self.resource_to_be_deleted = resource_to_be_deleted + + +class UnlockDeleteResponse(_serialization.Model): + """Response of Unlock Delete API. + + :ivar unlock_delete_expiry_time: This is the time when unlock delete privileges will get + expired. + :vartype unlock_delete_expiry_time: str + """ + + _attribute_map = { + "unlock_delete_expiry_time": {"key": "unlockDeleteExpiryTime", "type": "str"}, + } + + def __init__(self, *, unlock_delete_expiry_time: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword unlock_delete_expiry_time: This is the time when unlock delete privileges will get + expired. + :paramtype unlock_delete_expiry_time: str + """ + super().__init__(**kwargs) + self.unlock_delete_expiry_time = unlock_delete_expiry_time + + class UserFacingError(_serialization.Model): """Error object used by layers that have access to localized content, and propagate that to user. diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/__init__.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/__init__.py index 6775e75af5a7..0bf84afef994 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 @@ -23,6 +23,7 @@ from ._export_jobs_operation_result_operations import ExportJobsOperationResultOperations from ._deleted_backup_instances_operations import DeletedBackupInstancesOperations from ._resource_guards_operations import ResourceGuardsOperations +from ._dpp_resource_guard_proxy_operations import DppResourceGuardProxyOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -46,6 +47,7 @@ "ExportJobsOperationResultOperations", "DeletedBackupInstancesOperations", "ResourceGuardsOperations", + "DppResourceGuardProxyOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_instances_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_instances_operations.py index 4785178319a5..bf49e35c4d0d 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_instances_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_instances_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -32,10 +31,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +42,7 @@ def build_list_request(resource_group_name: str, vault_name: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -80,7 +75,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -114,7 +109,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -151,7 +146,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -185,7 +180,7 @@ def build_adhoc_backup_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -222,7 +217,7 @@ def build_validate_for_backup_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -252,7 +247,7 @@ def build_validate_for_backup_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_backup_instance_operation_result_request( +def build_get_backup_instance_operation_result_request( # pylint: disable=name-too-long resource_group_name: str, vault_name: str, backup_instance_name: str, @@ -263,7 +258,7 @@ def build_get_backup_instance_operation_result_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -298,7 +293,7 @@ def build_trigger_rehydrate_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -335,7 +330,7 @@ def build_trigger_restore_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -372,7 +367,7 @@ def build_resume_backups_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -406,7 +401,7 @@ def build_resume_protection_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -440,7 +435,7 @@ def build_stop_protection_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -474,7 +469,7 @@ def build_suspend_backups_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -508,7 +503,7 @@ def build_sync_backup_instance_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -545,7 +540,7 @@ def build_validate_for_restore_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -615,9 +610,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BackupInstanceResourceList] = kwargs.pop("cls", None) error_map = { @@ -671,8 +664,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -717,9 +711,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BackupInstanceResource] = kwargs.pop("cls", None) request = build_get_request( @@ -735,8 +727,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -775,9 +768,7 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.BackupInstanceResource]] = kwargs.pop("cls", None) @@ -805,8 +796,9 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -956,9 +948,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BackupInstanceResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1018,9 +1008,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -1036,8 +1024,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1089,9 +1078,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -1151,9 +1138,7 @@ def _adhoc_backup_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.OperationJobExtendedInfo]] = kwargs.pop("cls", None) @@ -1181,8 +1166,9 @@ def _adhoc_backup_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1333,9 +1319,7 @@ def begin_adhoc_backup( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.OperationJobExtendedInfo] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1399,9 +1383,7 @@ def _validate_for_backup_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.OperationJobExtendedInfo]] = kwargs.pop("cls", None) @@ -1428,8 +1410,9 @@ def _validate_for_backup_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1571,9 +1554,7 @@ def begin_validate_for_backup( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.OperationJobExtendedInfo] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1649,9 +1630,7 @@ def get_backup_instance_operation_result( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Optional[_models.BackupInstanceResource]] = kwargs.pop("cls", None) request = build_get_backup_instance_operation_result_request( @@ -1668,8 +1647,9 @@ def get_backup_instance_operation_result( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1710,9 +1690,7 @@ def _trigger_rehydrate_initial( # pylint: disable=inconsistent-return-statement _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1740,8 +1718,9 @@ def _trigger_rehydrate_initial( # pylint: disable=inconsistent-return-statement request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1880,9 +1859,7 @@ def begin_trigger_rehydrate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1945,9 +1922,7 @@ def _trigger_restore_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.OperationJobExtendedInfo]] = kwargs.pop("cls", None) @@ -1975,8 +1950,9 @@ def _trigger_restore_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2127,9 +2103,7 @@ def begin_trigger_restore( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.OperationJobExtendedInfo] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -2189,9 +2163,7 @@ def _resume_backups_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_resume_backups_request( @@ -2207,8 +2179,9 @@ def _resume_backups_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2260,9 +2233,7 @@ def begin_resume_backups( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -2317,9 +2288,7 @@ def _resume_protection_initial( # pylint: disable=inconsistent-return-statement _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_resume_protection_request( @@ -2335,8 +2304,9 @@ def _resume_protection_initial( # pylint: disable=inconsistent-return-statement request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2388,9 +2358,7 @@ def begin_resume_protection( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -2445,9 +2413,7 @@ def _stop_protection_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_stop_protection_request( @@ -2463,8 +2429,9 @@ def _stop_protection_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2516,9 +2483,7 @@ def begin_stop_protection( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -2573,9 +2538,7 @@ def _suspend_backups_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_suspend_backups_request( @@ -2591,8 +2554,9 @@ def _suspend_backups_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2645,9 +2609,7 @@ def begin_suspend_backups( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -2707,9 +2669,7 @@ def _sync_backup_instance_initial( # pylint: disable=inconsistent-return-statem _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) @@ -2737,8 +2697,9 @@ def _sync_backup_instance_initial( # pylint: disable=inconsistent-return-statem request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2880,9 +2841,7 @@ def begin_sync_backup_instance( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -2945,9 +2904,7 @@ def _validate_for_restore_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.OperationJobExtendedInfo]] = kwargs.pop("cls", None) @@ -2975,8 +2932,9 @@ def _validate_for_restore_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -3127,9 +3085,7 @@ def begin_validate_for_restore( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.OperationJobExtendedInfo] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_policies_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_policies_operations.py index 835efc4331cb..4529d156d7e1 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_policies_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_policies_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_list_request(resource_group_name: str, vault_name: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +73,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -112,7 +107,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -149,7 +144,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -217,9 +212,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BaseBackupPolicyResourceList] = kwargs.pop("cls", None) error_map = { @@ -273,8 +266,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -321,9 +315,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BaseBackupPolicyResource] = kwargs.pop("cls", None) request = build_get_request( @@ -339,8 +331,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -468,9 +461,7 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BaseBackupPolicyResource] = kwargs.pop("cls", None) @@ -498,8 +489,9 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -550,9 +542,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -568,8 +558,9 @@ def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_vault_operation_results_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_vault_operation_results_operations.py index a9863ab574be..324177fb55bb 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_vault_operation_results_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_vault_operation_results_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -121,9 +116,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Optional[_models.BackupVaultResource]] = kwargs.pop("cls", None) request = build_get_request( @@ -139,8 +132,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_vaults_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_vaults_operations.py index f25727eeb665..7321154ca6b8 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_vaults_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_vaults_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -32,10 +31,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +42,7 @@ def build_get_in_subscription_request(subscription_id: str, **kwargs: Any) -> Ht _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -71,7 +66,7 @@ def build_get_in_resource_group_request(resource_group_name: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -101,7 +96,7 @@ def build_get_request(resource_group_name: str, vault_name: str, subscription_id _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -134,7 +129,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -168,7 +163,7 @@ def build_delete_request(resource_group_name: str, vault_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -199,7 +194,7 @@ def build_update_request(resource_group_name: str, vault_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -235,7 +230,7 @@ def build_check_name_availability_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -296,9 +291,7 @@ def get_in_subscription(self, **kwargs: Any) -> Iterable["_models.BackupVaultRes _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BackupVaultResourceList] = kwargs.pop("cls", None) error_map = { @@ -350,8 +343,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -382,9 +376,7 @@ def get_in_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iter _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BackupVaultResourceList] = kwargs.pop("cls", None) error_map = { @@ -437,8 +429,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -479,9 +472,7 @@ def get(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> _mode _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BackupVaultResource] = kwargs.pop("cls", None) request = build_get_request( @@ -496,8 +487,9 @@ def get(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> _mode request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -535,9 +527,7 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BackupVaultResource] = kwargs.pop("cls", None) @@ -564,8 +554,9 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -698,9 +689,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BackupVaultResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -759,9 +748,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -776,8 +763,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -817,9 +805,7 @@ def begin_delete(self, resource_group_name: str, vault_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -877,9 +863,7 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.BackupVaultResource]] = kwargs.pop("cls", None) @@ -906,8 +890,9 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1041,9 +1026,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BackupVaultResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1187,9 +1170,7 @@ def check_name_availability( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.CheckNameAvailabilityResult] = kwargs.pop("cls", None) @@ -1216,8 +1197,9 @@ def check_name_availability( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_data_protection_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_data_protection_operations.py index af12a800b855..6b99c3d51aec 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_data_protection_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_data_protection_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +38,7 @@ def build_check_feature_support_request(location: str, subscription_id: str, **k _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -168,9 +163,7 @@ def check_feature_support( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.FeatureValidationResponseBase] = kwargs.pop("cls", None) @@ -196,8 +189,9 @@ def check_feature_support( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_data_protection_operations_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_data_protection_operations_operations.py index f8d0cd0e8dd8..df9eba055791 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_data_protection_operations_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_data_protection_operations_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,9 +88,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.ClientDiscoveryValueForSingle _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ClientDiscoveryResponse] = kwargs.pop("cls", None) error_map = { @@ -146,8 +139,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_deleted_backup_instances_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_deleted_backup_instances_operations.py index 1684d35cb8c9..6e03466ec99f 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_deleted_backup_instances_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_deleted_backup_instances_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast import urllib.parse @@ -32,10 +31,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +42,7 @@ def build_list_request(resource_group_name: str, vault_name: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -80,7 +75,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -114,7 +109,7 @@ def build_undelete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -182,9 +177,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DeletedBackupInstanceResourceList] = kwargs.pop("cls", None) error_map = { @@ -238,8 +231,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -284,9 +278,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DeletedBackupInstanceResource] = kwargs.pop("cls", None) request = build_get_request( @@ -302,8 +294,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -337,9 +330,7 @@ def _undelete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_undelete_request( @@ -355,8 +346,9 @@ def _undelete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -400,9 +392,7 @@ def begin_undelete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_dpp_resource_guard_proxy_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_dpp_resource_guard_proxy_operations.py new file mode 100644 index 000000000000..9b27b318f43e --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_dpp_resource_guard_proxy_operations.py @@ -0,0 +1,784 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request(resource_group_name: str, vault_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, vault_name: str, resource_guard_proxy_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGuardProxyName": _SERIALIZER.url( + "resource_guard_proxy_name", resource_guard_proxy_name, "str", pattern=r"^[A-Za-z0-9]*$" + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, vault_name: str, resource_guard_proxy_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGuardProxyName": _SERIALIZER.url( + "resource_guard_proxy_name", resource_guard_proxy_name, "str", pattern=r"^[A-Za-z0-9]*$" + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, vault_name: str, resource_guard_proxy_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGuardProxyName": _SERIALIZER.url( + "resource_guard_proxy_name", resource_guard_proxy_name, "str", pattern=r"^[A-Za-z0-9]*$" + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_unlock_delete_request( + resource_group_name: str, vault_name: str, resource_guard_proxy_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}/unlockDelete", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGuardProxyName": _SERIALIZER.url( + "resource_guard_proxy_name", resource_guard_proxy_name, "str", pattern=r"^[A-Za-z0-9]*$" + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class DppResourceGuardProxyOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.dataprotection.DataProtectionMgmtClient`'s + :attr:`dpp_resource_guard_proxy` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, vault_name: str, **kwargs: Any + ) -> Iterable["_models.ResourceGuardProxyBaseResource"]: + """Returns the list of ResourceGuardProxies associated with the vault. + + Returns the list of ResourceGuardProxies associated with the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceGuardProxyBaseResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ResourceGuardProxyBaseResourceList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ResourceGuardProxyBaseResourceList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies" + } + + @distributed_trace + def get( + self, resource_group_name: str, vault_name: str, resource_guard_proxy_name: str, **kwargs: Any + ) -> _models.ResourceGuardProxyBaseResource: + """Returns the ResourceGuardProxy object associated with the vault, and that matches the name in + the request. + + Returns the ResourceGuardProxy object associated with the vault, and that matches the name in + the request. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param resource_guard_proxy_name: name of the resource guard proxy. Required. + :type resource_guard_proxy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceGuardProxyBaseResource or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ResourceGuardProxyBaseResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + resource_guard_proxy_name=resource_guard_proxy_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ResourceGuardProxyBaseResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + vault_name: str, + resource_guard_proxy_name: str, + parameters: _models.ResourceGuardProxyBaseResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ResourceGuardProxyBaseResource: + """Creates or Updates a ResourceGuardProxy. + + Creates or Updates a ResourceGuardProxy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param resource_guard_proxy_name: name of the resource guard proxy. Required. + :type resource_guard_proxy_name: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceGuardProxyBaseResource or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + vault_name: str, + resource_guard_proxy_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ResourceGuardProxyBaseResource: + """Creates or Updates a ResourceGuardProxy. + + Creates or Updates a ResourceGuardProxy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param resource_guard_proxy_name: name of the resource guard proxy. Required. + :type resource_guard_proxy_name: str + :param parameters: Request body for operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceGuardProxyBaseResource or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + vault_name: str, + resource_guard_proxy_name: str, + parameters: Union[_models.ResourceGuardProxyBaseResource, IO], + **kwargs: Any + ) -> _models.ResourceGuardProxyBaseResource: + """Creates or Updates a ResourceGuardProxy. + + Creates or Updates a ResourceGuardProxy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param resource_guard_proxy_name: name of the resource guard proxy. Required. + :type resource_guard_proxy_name: str + :param parameters: Request body for operation. Is either a ResourceGuardProxyBaseResource type + or a IO type. Required. + :type parameters: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceGuardProxyBaseResource or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ResourceGuardProxyBaseResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ResourceGuardProxyBaseResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + resource_guard_proxy_name=resource_guard_proxy_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ResourceGuardProxyBaseResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, vault_name: str, resource_guard_proxy_name: str, **kwargs: Any + ) -> None: + """Deletes the ResourceGuardProxy. + + Deletes the ResourceGuardProxy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param resource_guard_proxy_name: name of the resource guard proxy. Required. + :type resource_guard_proxy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + resource_guard_proxy_name=resource_guard_proxy_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}" + } + + @overload + def unlock_delete( + self, + resource_group_name: str, + vault_name: str, + resource_guard_proxy_name: str, + parameters: _models.UnlockDeleteRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.UnlockDeleteResponse: + """UnlockDelete call for ResourceGuardProxy, executed before one can delete it. + + UnlockDelete call for ResourceGuardProxy, executed before one can delete it. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param resource_guard_proxy_name: name of the resource guard proxy. Required. + :type resource_guard_proxy_name: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.UnlockDeleteRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: UnlockDeleteResponse or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.UnlockDeleteResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def unlock_delete( + self, + resource_group_name: str, + vault_name: str, + resource_guard_proxy_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.UnlockDeleteResponse: + """UnlockDelete call for ResourceGuardProxy, executed before one can delete it. + + UnlockDelete call for ResourceGuardProxy, executed before one can delete it. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param resource_guard_proxy_name: name of the resource guard proxy. Required. + :type resource_guard_proxy_name: str + :param parameters: Request body for operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: UnlockDeleteResponse or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.UnlockDeleteResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def unlock_delete( + self, + resource_group_name: str, + vault_name: str, + resource_guard_proxy_name: str, + parameters: Union[_models.UnlockDeleteRequest, IO], + **kwargs: Any + ) -> _models.UnlockDeleteResponse: + """UnlockDelete call for ResourceGuardProxy, executed before one can delete it. + + UnlockDelete call for ResourceGuardProxy, executed before one can delete it. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param resource_guard_proxy_name: name of the resource guard proxy. Required. + :type resource_guard_proxy_name: str + :param parameters: Request body for operation. Is either a UnlockDeleteRequest type or a IO + type. Required. + :type parameters: ~azure.mgmt.dataprotection.models.UnlockDeleteRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: UnlockDeleteResponse or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.UnlockDeleteResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.UnlockDeleteResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "UnlockDeleteRequest") + + request = build_unlock_delete_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + resource_guard_proxy_name=resource_guard_proxy_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.unlock_delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("UnlockDeleteResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + unlock_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}/unlockDelete" + } diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_export_jobs_operation_result_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_export_jobs_operation_result_operations.py index ee4c8bc4c22f..d3de324fd046 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_export_jobs_operation_result_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_export_jobs_operation_result_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -123,9 +118,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Optional[_models.ExportJobsResult]] = kwargs.pop("cls", None) request = build_get_request( @@ -141,8 +134,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_export_jobs_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_export_jobs_operations.py index f9b98b8f27c0..dc89dafb70fd 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_export_jobs_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_export_jobs_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.exceptions import ( @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +42,7 @@ def build_trigger_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -107,9 +102,7 @@ def _trigger_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_trigger_request( @@ -124,8 +117,9 @@ def _trigger_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -170,9 +164,7 @@ def begin_trigger(self, resource_group_name: str, vault_name: str, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_jobs_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_jobs_operations.py index 175f6d3e2641..4a2875ff305a 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_jobs_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_jobs_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_list_request(resource_group_name: str, vault_name: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +73,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -145,9 +140,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AzureBackupJobResourceList] = kwargs.pop("cls", None) error_map = { @@ -201,8 +194,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -248,9 +242,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AzureBackupJobResource] = kwargs.pop("cls", None) request = build_get_request( @@ -266,8 +258,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_result_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_result_operations.py index 9d8abf9159ef..7b432322ebef 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_result_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_result_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +38,7 @@ def build_get_request(operation_id: str, location: str, subscription_id: str, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -113,9 +108,7 @@ def get(self, operation_id: str, location: str, **kwargs: Any) -> Optional[_mode _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Optional[_models.OperationJobExtendedInfo]] = kwargs.pop("cls", None) request = build_get_request( @@ -130,8 +123,9 @@ def get(self, operation_id: str, location: str, **kwargs: Any) -> Optional[_mode request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_status_backup_vault_context_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_status_backup_vault_context_operations.py index b740da95abb5..41ab41ca2d5b 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_status_backup_vault_context_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_status_backup_vault_context_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -123,9 +118,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationResource] = kwargs.pop("cls", None) request = build_get_request( @@ -141,8 +134,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_status_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_status_operations.py index 536cc4c0b384..51f0b6485661 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_status_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_status_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +38,7 @@ def build_get_request(location: str, operation_id: str, subscription_id: str, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -113,9 +108,7 @@ def get(self, location: str, operation_id: str, **kwargs: Any) -> _models.Operat _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationResource] = kwargs.pop("cls", None) request = build_get_request( @@ -130,8 +123,9 @@ def get(self, location: str, operation_id: str, **kwargs: Any) -> _models.Operat request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_status_resource_group_context_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_status_resource_group_context_operations.py index 06e17f96fc26..7b347c432710 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_status_resource_group_context_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_status_resource_group_context_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +38,7 @@ def build_get_request(resource_group_name: str, operation_id: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -116,9 +111,7 @@ def get(self, resource_group_name: str, operation_id: str, **kwargs: Any) -> _mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationResource] = kwargs.pop("cls", None) request = build_get_request( @@ -133,8 +126,9 @@ def get(self, resource_group_name: str, operation_id: str, **kwargs: Any) -> _mo request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_recovery_points_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_recovery_points_operations.py index ffd71b60bb89..da0c5e2e7cbe 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_recovery_points_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_recovery_points_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -54,7 +49,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +92,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -178,9 +173,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AzureBackupRecoveryPointResourceList] = kwargs.pop("cls", None) error_map = { @@ -237,8 +230,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -290,9 +284,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AzureBackupRecoveryPointResource] = kwargs.pop("cls", None) request = build_get_request( @@ -309,8 +301,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_resource_guards_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_resource_guards_operations.py index 80fc87757ec8..5b1da8df01e1 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_resource_guards_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_resource_guards_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,11 +36,13 @@ _SERIALIZER.client_side_validation = False -def build_get_resources_in_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_get_resources_in_subscription_request( # pylint: disable=name-too-long + subscription_id: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -67,13 +64,13 @@ def build_get_resources_in_subscription_request(subscription_id: str, **kwargs: return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_resources_in_resource_group_request( +def build_get_resources_in_resource_group_request( # pylint: disable=name-too-long resource_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -105,7 +102,7 @@ def build_put_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -141,7 +138,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -174,7 +171,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -207,7 +204,7 @@ def build_patch_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -237,13 +234,13 @@ def build_patch_request( return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_disable_soft_delete_requests_objects_request( +def build_get_disable_soft_delete_requests_objects_request( # pylint: disable=name-too-long resource_group_name: str, resource_guards_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -270,13 +267,13 @@ def build_get_disable_soft_delete_requests_objects_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_delete_resource_guard_proxy_requests_objects_request( +def build_get_delete_resource_guard_proxy_requests_objects_request( # pylint: disable=name-too-long resource_group_name: str, resource_guards_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -303,13 +300,13 @@ def build_get_delete_resource_guard_proxy_requests_objects_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_backup_security_pin_requests_objects_request( +def build_get_backup_security_pin_requests_objects_request( # pylint: disable=name-too-long resource_group_name: str, resource_guards_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -336,13 +333,13 @@ def build_get_backup_security_pin_requests_objects_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_delete_protected_item_requests_objects_request( +def build_get_delete_protected_item_requests_objects_request( # pylint: disable=name-too-long resource_group_name: str, resource_guards_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -369,13 +366,13 @@ def build_get_delete_protected_item_requests_objects_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_update_protection_policy_requests_objects_request( +def build_get_update_protection_policy_requests_objects_request( # pylint: disable=name-too-long resource_group_name: str, resource_guards_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -402,13 +399,13 @@ def build_get_update_protection_policy_requests_objects_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_update_protected_item_requests_objects_request( +def build_get_update_protected_item_requests_objects_request( # pylint: disable=name-too-long resource_group_name: str, resource_guards_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -435,13 +432,13 @@ def build_get_update_protected_item_requests_objects_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_default_disable_soft_delete_requests_object_request( +def build_get_default_disable_soft_delete_requests_object_request( # pylint: disable=name-too-long resource_group_name: str, resource_guards_name: str, request_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -469,13 +466,13 @@ def build_get_default_disable_soft_delete_requests_object_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_default_delete_resource_guard_proxy_requests_object_request( +def build_get_default_delete_resource_guard_proxy_requests_object_request( # pylint: disable=name-too-long resource_group_name: str, resource_guards_name: str, request_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -503,13 +500,13 @@ def build_get_default_delete_resource_guard_proxy_requests_object_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_default_backup_security_pin_requests_object_request( +def build_get_default_backup_security_pin_requests_object_request( # pylint: disable=name-too-long resource_group_name: str, resource_guards_name: str, request_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -537,13 +534,13 @@ def build_get_default_backup_security_pin_requests_object_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_default_delete_protected_item_requests_object_request( +def build_get_default_delete_protected_item_requests_object_request( # pylint: disable=name-too-long resource_group_name: str, resource_guards_name: str, request_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -571,13 +568,13 @@ def build_get_default_delete_protected_item_requests_object_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_default_update_protection_policy_requests_object_request( +def build_get_default_update_protection_policy_requests_object_request( # pylint: disable=name-too-long resource_group_name: str, resource_guards_name: str, request_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -605,13 +602,13 @@ def build_get_default_update_protection_policy_requests_object_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_default_update_protected_item_requests_object_request( +def build_get_default_update_protected_item_requests_object_request( # pylint: disable=name-too-long resource_group_name: str, resource_guards_name: str, request_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -673,9 +670,7 @@ def get_resources_in_subscription(self, **kwargs: Any) -> Iterable["_models.Reso _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ResourceGuardResourceList] = kwargs.pop("cls", None) error_map = { @@ -727,8 +722,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -764,9 +760,7 @@ def get_resources_in_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ResourceGuardResourceList] = kwargs.pop("cls", None) error_map = { @@ -819,8 +813,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -935,9 +930,7 @@ def put( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ResourceGuardResource] = kwargs.pop("cls", None) @@ -964,8 +957,9 @@ def put( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1016,9 +1010,7 @@ def get(self, resource_group_name: str, resource_guards_name: str, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ResourceGuardResource] = kwargs.pop("cls", None) request = build_get_request( @@ -1033,8 +1025,9 @@ def get(self, resource_group_name: str, resource_guards_name: str, **kwargs: Any request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1083,9 +1076,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -1100,8 +1091,9 @@ def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1222,9 +1214,7 @@ def patch( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ResourceGuardResource] = kwargs.pop("cls", None) @@ -1251,8 +1241,9 @@ def patch( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1295,9 +1286,7 @@ def get_disable_soft_delete_requests_objects( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DppBaseResourceList] = kwargs.pop("cls", None) error_map = { @@ -1351,8 +1340,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1369,7 +1359,7 @@ def get_next(next_link=None): } @distributed_trace - def get_delete_resource_guard_proxy_requests_objects( + def get_delete_resource_guard_proxy_requests_objects( # pylint: disable=name-too-long self, resource_group_name: str, resource_guards_name: str, **kwargs: Any ) -> Iterable["_models.DppBaseResource"]: """Returns collection of operation request objects for a critical operation protected by the given @@ -1391,9 +1381,7 @@ def get_delete_resource_guard_proxy_requests_objects( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DppBaseResourceList] = kwargs.pop("cls", None) error_map = { @@ -1447,8 +1435,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1487,9 +1476,7 @@ def get_backup_security_pin_requests_objects( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DppBaseResourceList] = kwargs.pop("cls", None) error_map = { @@ -1543,8 +1530,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1561,7 +1549,7 @@ def get_next(next_link=None): } @distributed_trace - def get_delete_protected_item_requests_objects( + def get_delete_protected_item_requests_objects( # pylint: disable=name-too-long self, resource_group_name: str, resource_guards_name: str, **kwargs: Any ) -> Iterable["_models.DppBaseResource"]: """Returns collection of operation request objects for a critical operation protected by the given @@ -1583,9 +1571,7 @@ def get_delete_protected_item_requests_objects( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DppBaseResourceList] = kwargs.pop("cls", None) error_map = { @@ -1639,8 +1625,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1657,7 +1644,7 @@ def get_next(next_link=None): } @distributed_trace - def get_update_protection_policy_requests_objects( + def get_update_protection_policy_requests_objects( # pylint: disable=name-too-long self, resource_group_name: str, resource_guards_name: str, **kwargs: Any ) -> Iterable["_models.DppBaseResource"]: """Returns collection of operation request objects for a critical operation protected by the given @@ -1679,9 +1666,7 @@ def get_update_protection_policy_requests_objects( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DppBaseResourceList] = kwargs.pop("cls", None) error_map = { @@ -1735,8 +1720,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1753,7 +1739,7 @@ def get_next(next_link=None): } @distributed_trace - def get_update_protected_item_requests_objects( + def get_update_protected_item_requests_objects( # pylint: disable=name-too-long self, resource_group_name: str, resource_guards_name: str, **kwargs: Any ) -> Iterable["_models.DppBaseResource"]: """Returns collection of operation request objects for a critical operation protected by the given @@ -1775,9 +1761,7 @@ def get_update_protected_item_requests_objects( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DppBaseResourceList] = kwargs.pop("cls", None) error_map = { @@ -1831,8 +1815,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1849,7 +1834,7 @@ def get_next(next_link=None): } @distributed_trace - def get_default_disable_soft_delete_requests_object( + def get_default_disable_soft_delete_requests_object( # pylint: disable=name-too-long self, resource_group_name: str, resource_guards_name: str, request_name: str, **kwargs: Any ) -> _models.DppBaseResource: """Returns collection of operation request objects for a critical operation protected by the given @@ -1881,9 +1866,7 @@ def get_default_disable_soft_delete_requests_object( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) request = build_get_default_disable_soft_delete_requests_object_request( @@ -1899,8 +1882,9 @@ def get_default_disable_soft_delete_requests_object( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1921,7 +1905,7 @@ def get_default_disable_soft_delete_requests_object( } @distributed_trace - def get_default_delete_resource_guard_proxy_requests_object( + def get_default_delete_resource_guard_proxy_requests_object( # pylint: disable=name-too-long self, resource_group_name: str, resource_guards_name: str, request_name: str, **kwargs: Any ) -> _models.DppBaseResource: """Returns collection of operation request objects for a critical operation protected by the given @@ -1953,9 +1937,7 @@ def get_default_delete_resource_guard_proxy_requests_object( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) request = build_get_default_delete_resource_guard_proxy_requests_object_request( @@ -1971,8 +1953,9 @@ def get_default_delete_resource_guard_proxy_requests_object( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1993,7 +1976,7 @@ def get_default_delete_resource_guard_proxy_requests_object( } @distributed_trace - def get_default_backup_security_pin_requests_object( + def get_default_backup_security_pin_requests_object( # pylint: disable=name-too-long self, resource_group_name: str, resource_guards_name: str, request_name: str, **kwargs: Any ) -> _models.DppBaseResource: """Returns collection of operation request objects for a critical operation protected by the given @@ -2025,9 +2008,7 @@ def get_default_backup_security_pin_requests_object( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) request = build_get_default_backup_security_pin_requests_object_request( @@ -2043,8 +2024,9 @@ def get_default_backup_security_pin_requests_object( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2065,7 +2047,7 @@ def get_default_backup_security_pin_requests_object( } @distributed_trace - def get_default_delete_protected_item_requests_object( + def get_default_delete_protected_item_requests_object( # pylint: disable=name-too-long self, resource_group_name: str, resource_guards_name: str, request_name: str, **kwargs: Any ) -> _models.DppBaseResource: """Returns collection of operation request objects for a critical operation protected by the given @@ -2097,9 +2079,7 @@ def get_default_delete_protected_item_requests_object( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) request = build_get_default_delete_protected_item_requests_object_request( @@ -2115,8 +2095,9 @@ def get_default_delete_protected_item_requests_object( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2137,7 +2118,7 @@ def get_default_delete_protected_item_requests_object( } @distributed_trace - def get_default_update_protection_policy_requests_object( + def get_default_update_protection_policy_requests_object( # pylint: disable=name-too-long self, resource_group_name: str, resource_guards_name: str, request_name: str, **kwargs: Any ) -> _models.DppBaseResource: """Returns collection of operation request objects for a critical operation protected by the given @@ -2169,9 +2150,7 @@ def get_default_update_protection_policy_requests_object( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) request = build_get_default_update_protection_policy_requests_object_request( @@ -2187,8 +2166,9 @@ def get_default_update_protection_policy_requests_object( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2209,7 +2189,7 @@ def get_default_update_protection_policy_requests_object( } @distributed_trace - def get_default_update_protected_item_requests_object( + def get_default_update_protected_item_requests_object( # pylint: disable=name-too-long self, resource_group_name: str, resource_guards_name: str, request_name: str, **kwargs: Any ) -> _models.DppBaseResource: """Returns collection of operation request objects for a critical operation protected by the given @@ -2241,9 +2221,7 @@ def get_default_update_protected_item_requests_object( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) request = build_get_default_update_protected_item_requests_object_request( @@ -2259,8 +2237,9 @@ def get_default_update_protected_item_requests_object( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_restorable_time_ranges_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_restorable_time_ranges_operations.py index c0cca8ba6077..0a6ed66538bc 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_restorable_time_ranges_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_restorable_time_ranges_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_find_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -198,9 +193,7 @@ def find( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-01-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AzureBackupFindRestorableTimeRangesResponseResource] = kwargs.pop("cls", None) @@ -228,8 +221,9 @@ def find( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/check_backup_vaults_name_availability.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/check_backup_vaults_name_availability.py index 2f0518eaa747..6926835ef48d 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/check_backup_vaults_name_availability.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/check_backup_vaults_name_availability.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/VaultCRUD/CheckBackupVaultsNameAvailability.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/VaultCRUD/CheckBackupVaultsNameAvailability.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/checkfeature_support.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/checkfeature_support.py index 12f99e0f59ec..cdfef822bdd7 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/checkfeature_support.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/checkfeature_support.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/CheckfeatureSupport.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/CheckfeatureSupport.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/create_or_update_backup_policy.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/create_or_update_backup_policy.py index 5599e3b95e8a..76f5274f95b9 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/create_or_update_backup_policy.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/create_or_update_backup_policy.py @@ -92,6 +92,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/PolicyCRUD/CreateOrUpdateBackupPolicy.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/PolicyCRUD/CreateOrUpdateBackupPolicy.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_backup_instance.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_backup_instance.py index 9a84f9203a69..516fed280511 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_backup_instance.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_backup_instance.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/BackupInstanceOperations/DeleteBackupInstance.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/BackupInstanceOperations/DeleteBackupInstance.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_backup_policy.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_backup_policy.py index 91243b96f408..e455ca43bcb2 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_backup_policy.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_backup_policy.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/PolicyCRUD/DeleteBackupPolicy.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/PolicyCRUD/DeleteBackupPolicy.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_backup_vault.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_backup_vault.py index f6e9f845f510..46ede76c2340 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_backup_vault.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_backup_vault.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/VaultCRUD/DeleteBackupVault.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/VaultCRUD/DeleteBackupVault.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_resource_guard.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_resource_guard.py index d7cce2e2bc37..ceeace0c608f 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_resource_guard.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_resource_guard.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/ResourceGuardCRUD/DeleteResourceGuard.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/ResourceGuardCRUD/DeleteResourceGuard.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_resource_guard_proxy.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_resource_guard_proxy.py new file mode 100644 index 000000000000..0517be94974e --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_resource_guard_proxy.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.dataprotection import DataProtectionMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python delete_resource_guard_proxy.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DataProtectionMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="5e13b949-1218-4d18-8b99-7e12155ec4f7", + ) + + response = client.dpp_resource_guard_proxy.delete( + resource_group_name="SampleResourceGroup", + vault_name="sampleVault", + resource_guard_proxy_name="swaggerExample", + ) + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/ResourceGuardProxyCRUD/DeleteResourceGuardProxy.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/find_restorable_time_ranges.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/find_restorable_time_ranges.py index d2170dc28d25..3d3ca5f9c3b9 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/find_restorable_time_ranges.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/find_restorable_time_ranges.py @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/BackupInstanceOperations/FindRestorableTimeRanges.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/BackupInstanceOperations/FindRestorableTimeRanges.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_instance.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_instance.py index 1cf9e309eec7..4009afc8767a 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_instance.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_instance.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/BackupInstanceOperations/GetBackupInstance.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/BackupInstanceOperations/GetBackupInstance.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_instance_operation_result.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_instance_operation_result.py index 3803e69c2d09..1d6ded65f970 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_instance_operation_result.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_instance_operation_result.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/BackupInstanceOperations/GetBackupInstanceOperationResult.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/BackupInstanceOperations/GetBackupInstanceOperationResult.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_policy.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_policy.py index ff3de052ba14..5522adaa8be6 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_policy.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_policy.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/PolicyCRUD/GetBackupPolicy.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/PolicyCRUD/GetBackupPolicy.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vault.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vault.py index 40ab5b193cfd..920be686e37b 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vault.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vault.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/VaultCRUD/GetBackupVault.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/VaultCRUD/GetBackupVault.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vault_with_msi.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vault_with_msi.py index 6ef34c599719..8a6baece5ef4 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vault_with_msi.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vault_with_msi.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/VaultCRUD/GetBackupVaultWithMSI.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/VaultCRUD/GetBackupVaultWithMSI.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vaults_in_resource_group.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vaults_in_resource_group.py index aafff102d7d3..4b6d946f8a99 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vaults_in_resource_group.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vaults_in_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/VaultCRUD/GetBackupVaultsInResourceGroup.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/VaultCRUD/GetBackupVaultsInResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vaults_in_subscription.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vaults_in_subscription.py index 18dc42a3354a..d038ae278bc4 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vaults_in_subscription.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vaults_in_subscription.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/VaultCRUD/GetBackupVaultsInSubscription.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/VaultCRUD/GetBackupVaultsInSubscription.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_backup_security_pin_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_backup_security_pin_requests.py index 9ef616f43172..95550a9d0552 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_backup_security_pin_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_backup_security_pin_requests.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/ResourceGuardCRUD/GetDefaultBackupSecurityPINRequests.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/ResourceGuardCRUD/GetDefaultBackupSecurityPINRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_delete_protected_item_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_delete_protected_item_requests.py index bdea96983368..d87543f09089 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_delete_protected_item_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_delete_protected_item_requests.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/ResourceGuardCRUD/GetDefaultDeleteProtectedItemRequests.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/ResourceGuardCRUD/GetDefaultDeleteProtectedItemRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_delete_resource_guard_proxy_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_delete_resource_guard_proxy_requests.py index 048724f717c4..d3913d600e3f 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_delete_resource_guard_proxy_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_delete_resource_guard_proxy_requests.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/ResourceGuardCRUD/GetDefaultDeleteResourceGuardProxyRequests.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/ResourceGuardCRUD/GetDefaultDeleteResourceGuardProxyRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_disable_soft_delete_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_disable_soft_delete_requests.py index c48ed83ef6d8..843c8962744c 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_disable_soft_delete_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_disable_soft_delete_requests.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/ResourceGuardCRUD/GetDefaultDisableSoftDeleteRequests.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/ResourceGuardCRUD/GetDefaultDisableSoftDeleteRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_update_protected_item_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_update_protected_item_requests.py index 75164aa33e4e..ea77f72c6b89 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_update_protected_item_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_update_protected_item_requests.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/ResourceGuardCRUD/GetDefaultUpdateProtectedItemRequests.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/ResourceGuardCRUD/GetDefaultUpdateProtectedItemRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_update_protection_policy_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_update_protection_policy_requests.py index 7509403597ac..34a9b6e7f409 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_update_protection_policy_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_update_protection_policy_requests.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/ResourceGuardCRUD/GetDefaultUpdateProtectionPolicyRequests.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/ResourceGuardCRUD/GetDefaultUpdateProtectionPolicyRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_deleted_backup_instance.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_deleted_backup_instance.py index 85dc5180a54a..a87772c9c313 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_deleted_backup_instance.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_deleted_backup_instance.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/DeletedBackupInstanceOperations/GetDeletedBackupInstance.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/DeletedBackupInstanceOperations/GetDeletedBackupInstance.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_export_jobs_operation_result.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_export_jobs_operation_result.py index a60bf7071971..daf982861dc5 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_export_jobs_operation_result.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_export_jobs_operation_result.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/JobCRUD/GetExportJobsOperationResult.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/JobCRUD/GetExportJobsOperationResult.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_job.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_job.py index f92e2e493a69..ff2fd9bd7321 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_job.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_job.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/JobCRUD/GetJob.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/JobCRUD/GetJob.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_result.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_result.py index 5ba961f82086..1b5b3634c7a2 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_result.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_result.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/GetOperationResult.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/GetOperationResult.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_result_patch.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_result_patch.py index dbabe2412825..c364950cc8aa 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_result_patch.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_result_patch.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/VaultCRUD/GetOperationResultPatch.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/VaultCRUD/GetOperationResultPatch.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_status.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_status.py index a63fcacf252d..393891eeeee2 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_status.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_status.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/GetOperationStatus.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/GetOperationStatus.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_status_rg_context.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_status_rg_context.py index 21ed213bd15f..ff8cb7be1c76 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_status_rg_context.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_status_rg_context.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/GetOperationStatusRGContext.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/GetOperationStatusRGContext.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_status_vault_context.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_status_vault_context.py index 869cf99d2a0b..e32ed7baec9c 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_status_vault_context.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_status_vault_context.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/GetOperationStatusVaultContext.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/GetOperationStatusVaultContext.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_recovery_point.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_recovery_point.py index 8c9f93b232c1..de9e2473bad2 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_recovery_point.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_recovery_point.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/BackupInstanceOperations/GetRecoveryPoint.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/BackupInstanceOperations/GetRecoveryPoint.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_resource_guard.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_resource_guard.py index eeab967f164a..eb1a1284a187 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_resource_guard.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_resource_guard.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/ResourceGuardCRUD/GetResourceGuard.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/ResourceGuardCRUD/GetResourceGuard.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_resource_guard_proxy.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_resource_guard_proxy.py new file mode 100644 index 000000000000..6e60178e41a5 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_resource_guard_proxy.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.dataprotection import DataProtectionMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python get_resource_guard_proxy.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DataProtectionMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="5e13b949-1218-4d18-8b99-7e12155ec4f7", + ) + + response = client.dpp_resource_guard_proxy.get( + resource_group_name="SampleResourceGroup", + vault_name="sampleVault", + resource_guard_proxy_name="swaggerExample", + ) + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/ResourceGuardProxyCRUD/GetResourceGuardProxy.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_resource_guards_in_resource_group.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_resource_guards_in_resource_group.py index 4d8bc7672259..4f81a4a70827 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_resource_guards_in_resource_group.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_resource_guards_in_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/ResourceGuardCRUD/GetResourceGuardsInResourceGroup.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/ResourceGuardCRUD/GetResourceGuardsInResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_resource_guards_in_subscription.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_resource_guards_in_subscription.py index dad6a72c0394..ef3a5853a867 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_resource_guards_in_subscription.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_resource_guards_in_subscription.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/ResourceGuardCRUD/GetResourceGuardsInSubscription.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/ResourceGuardCRUD/GetResourceGuardsInSubscription.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list.py index be4e658e5cb4..d6691da9726f 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/Operations/List.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/Operations/List.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_backup_instances.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_backup_instances.py index 0cb064ea8752..a9748e6da0e3 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_backup_instances.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_backup_instances.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/BackupInstanceOperations/ListBackupInstances.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/BackupInstanceOperations/ListBackupInstances.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_backup_policy.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_backup_policy.py index 9787090445b1..6e32b5551410 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_backup_policy.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_backup_policy.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/PolicyCRUD/ListBackupPolicy.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/PolicyCRUD/ListBackupPolicy.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_backup_security_pin_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_backup_security_pin_requests.py index 989a036708e3..df01f32f63d6 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_backup_security_pin_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_backup_security_pin_requests.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/ResourceGuardCRUD/ListBackupSecurityPINRequests.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/ResourceGuardCRUD/ListBackupSecurityPINRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_delete_protected_item_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_delete_protected_item_requests.py index 76c3c90d301d..dadc283d6c1d 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_delete_protected_item_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_delete_protected_item_requests.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/ResourceGuardCRUD/ListDeleteProtectedItemRequests.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/ResourceGuardCRUD/ListDeleteProtectedItemRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_delete_resource_guard_proxy_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_delete_resource_guard_proxy_requests.py index 875d69fc77b1..563476bce2cc 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_delete_resource_guard_proxy_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_delete_resource_guard_proxy_requests.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/ResourceGuardCRUD/ListDeleteResourceGuardProxyRequests.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/ResourceGuardCRUD/ListDeleteResourceGuardProxyRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_deleted_backup_instances.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_deleted_backup_instances.py index 691976969356..dfe33c91e4eb 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_deleted_backup_instances.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_deleted_backup_instances.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/DeletedBackupInstanceOperations/ListDeletedBackupInstances.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/DeletedBackupInstanceOperations/ListDeletedBackupInstances.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_disable_soft_delete_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_disable_soft_delete_requests.py index 172ef1e1677f..e9ea4e28e78d 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_disable_soft_delete_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_disable_soft_delete_requests.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/ResourceGuardCRUD/ListDisableSoftDeleteRequests.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/ResourceGuardCRUD/ListDisableSoftDeleteRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_jobs.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_jobs.py index 8468d25256ec..ba789cd5b80a 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_jobs.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_jobs.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/JobCRUD/ListJobs.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/JobCRUD/ListJobs.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_recovery_points.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_recovery_points.py index ccf70f19b7aa..a07e4ea9c063 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_recovery_points.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_recovery_points.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/BackupInstanceOperations/ListRecoveryPoints.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/BackupInstanceOperations/ListRecoveryPoints.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_resource_guard_proxy.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_resource_guard_proxy.py new file mode 100644 index 000000000000..d9c253fd416a --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_resource_guard_proxy.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.dataprotection import DataProtectionMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python list_resource_guard_proxy.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DataProtectionMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="5e13b949-1218-4d18-8b99-7e12155ec4f7", + ) + + response = client.dpp_resource_guard_proxy.list( + resource_group_name="SampleResourceGroup", + vault_name="sampleVault", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/ResourceGuardProxyCRUD/ListResourceGuardProxy.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_update_protected_item_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_update_protected_item_requests.py index 26727b9ee3c2..2a50e36c082b 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_update_protected_item_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_update_protected_item_requests.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/ResourceGuardCRUD/ListUpdateProtectedItemRequests.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/ResourceGuardCRUD/ListUpdateProtectedItemRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_update_protection_policy_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_update_protection_policy_requests.py index 1824db65e475..4df8c388fc0b 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_update_protection_policy_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_update_protection_policy_requests.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/ResourceGuardCRUD/ListUpdateProtectionPolicyRequests.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/ResourceGuardCRUD/ListUpdateProtectionPolicyRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/patch_backup_vault.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/patch_backup_vault.py index 9e124e202f75..53c063d510cc 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/patch_backup_vault.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/patch_backup_vault.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/VaultCRUD/PatchBackupVault.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/VaultCRUD/PatchBackupVault.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/patch_resource_guard.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/patch_resource_guard.py index e43cfa62e5c3..d856325644c5 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/patch_resource_guard.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/patch_resource_guard.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/ResourceGuardCRUD/PatchResourceGuard.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/ResourceGuardCRUD/PatchResourceGuard.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_backup_instance.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_backup_instance.py index 9024ef37b192..d3a9d6ea8556 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_backup_instance.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_backup_instance.py @@ -82,6 +82,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/BackupInstanceOperations/PutBackupInstance.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/BackupInstanceOperations/PutBackupInstance.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_backup_vault.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_backup_vault.py index 0d3fde6f43ea..ba6db9438216 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_backup_vault.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_backup_vault.py @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/VaultCRUD/PutBackupVault.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/VaultCRUD/PutBackupVault.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_backup_vault_with_msi.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_backup_vault_with_msi.py index 12c0798d5a7d..b169bbd6659f 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_backup_vault_with_msi.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_backup_vault_with_msi.py @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/VaultCRUD/PutBackupVaultWithMSI.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/VaultCRUD/PutBackupVaultWithMSI.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_resource_guard.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_resource_guard.py index e5f511c32004..12eb5d92ccfc 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_resource_guard.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_resource_guard.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/ResourceGuardCRUD/PutResourceGuard.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/ResourceGuardCRUD/PutResourceGuard.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_resource_guard_proxy.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_resource_guard_proxy.py new file mode 100644 index 000000000000..e963f35647bf --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_resource_guard_proxy.py @@ -0,0 +1,47 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.dataprotection import DataProtectionMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python put_resource_guard_proxy.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DataProtectionMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="5e13b949-1218-4d18-8b99-7e12155ec4f7", + ) + + response = client.dpp_resource_guard_proxy.create_or_update( + resource_group_name="SampleResourceGroup", + vault_name="sampleVault", + resource_guard_proxy_name="swaggerExample", + parameters={ + "properties": { + "resourceGuardResourceId": "/subscriptions/f9e67185-f313-4e79-aa71-6458d429369d/resourceGroups/ResourceGuardSecurityAdminRG/providers/Microsoft.DataProtection/resourceGuards/ResourceGuardTestResource" + } + }, + ) + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/ResourceGuardProxyCRUD/PutResourceGuardProxy.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resume_backups.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resume_backups.py index 8add7547813a..3ee3c952c712 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resume_backups.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resume_backups.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/BackupInstanceOperations/ResumeBackups.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/BackupInstanceOperations/ResumeBackups.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resume_protection.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resume_protection.py index 430e15a58c44..e84dc763cc6f 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resume_protection.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resume_protection.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/BackupInstanceOperations/ResumeProtection.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/BackupInstanceOperations/ResumeProtection.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/stop_protection.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/stop_protection.py index 5de598e3fc59..11c921540116 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/stop_protection.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/stop_protection.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/BackupInstanceOperations/StopProtection.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/BackupInstanceOperations/StopProtection.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/suspend_backups.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/suspend_backups.py index 9cbd6566427d..6da803b1ce9a 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/suspend_backups.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/suspend_backups.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/BackupInstanceOperations/SuspendBackups.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/BackupInstanceOperations/SuspendBackups.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/sync_backup_instance.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/sync_backup_instance.py index 0c72da54d75f..e0ce50489288 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/sync_backup_instance.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/sync_backup_instance.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/BackupInstanceOperations/SyncBackupInstance.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/BackupInstanceOperations/SyncBackupInstance.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_backup.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_backup.py index 9eb9254593fd..dcfcb2f928d8 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_backup.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_backup.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/BackupInstanceOperations/TriggerBackup.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/BackupInstanceOperations/TriggerBackup.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_export_jobs.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_export_jobs.py index 4a5687899444..11c0a0d8b4db 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_export_jobs.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_export_jobs.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/JobCRUD/TriggerExportJobs.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/JobCRUD/TriggerExportJobs.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_rehydrate.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_rehydrate.py index 663efe90445c..9ff9158829ce 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_rehydrate.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_rehydrate.py @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/BackupInstanceOperations/TriggerRehydrate.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/BackupInstanceOperations/TriggerRehydrate.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_restore.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_restore.py index 0bb40d5058ed..536d9c5d3378 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_restore.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_restore.py @@ -73,6 +73,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/BackupInstanceOperations/TriggerRestore.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/BackupInstanceOperations/TriggerRestore.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_restore_as_files.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_restore_as_files.py index de3a93cb35ea..52d13304639b 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_restore_as_files.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_restore_as_files.py @@ -53,6 +53,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/BackupInstanceOperations/TriggerRestoreAsFiles.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/BackupInstanceOperations/TriggerRestoreAsFiles.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_restore_with_rehydration.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_restore_with_rehydration.py index 77063609e51e..990dcf8ad3fd 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_restore_with_rehydration.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_restore_with_rehydration.py @@ -68,6 +68,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/BackupInstanceOperations/TriggerRestoreWithRehydration.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/BackupInstanceOperations/TriggerRestoreWithRehydration.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/undelete_deleted_backup_instance.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/undelete_deleted_backup_instance.py index 08f085695414..80ce211cf38c 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/undelete_deleted_backup_instance.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/undelete_deleted_backup_instance.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/DeletedBackupInstanceOperations/UndeleteDeletedBackupInstance.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/DeletedBackupInstanceOperations/UndeleteDeletedBackupInstance.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/unlock_delete_resource_guard_proxy.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/unlock_delete_resource_guard_proxy.py new file mode 100644 index 000000000000..dcfb643ebab9 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/unlock_delete_resource_guard_proxy.py @@ -0,0 +1,48 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.dataprotection import DataProtectionMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python unlock_delete_resource_guard_proxy.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DataProtectionMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="5e13b949-1218-4d18-8b99-7e12155ec4f7", + ) + + response = client.dpp_resource_guard_proxy.unlock_delete( + resource_group_name="SampleResourceGroup", + vault_name="sampleVault", + resource_guard_proxy_name="swaggerExample", + parameters={ + "resourceGuardOperationRequests": [ + "/subscriptions/f9e67185-f313-4e79-aa71-6458d429369d/resourceGroups/ResourceGuardSecurityAdminRG/providers/Microsoft.DataProtection/resourceGuards/ResourceGuardTestResource/deleteBackupInstanceRequests/default" + ], + "resourceToBeDeleted": "/subscriptions/5e13b949-1218-4d18-8b99-7e12155ec4f7/resourceGroups/SampleResourceGroup/providers/Microsoft.DataProtection/backupVaults/sampleVault/backupInstances/TestBI9779f4de", + }, + ) + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/ResourceGuardProxyCRUD/UnlockDeleteResourceGuardProxy.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/validate_for_backup.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/validate_for_backup.py index 8da385ced1be..63cbbebe8e8c 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/validate_for_backup.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/validate_for_backup.py @@ -70,6 +70,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/BackupInstanceOperations/ValidateForBackup.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/BackupInstanceOperations/ValidateForBackup.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/validate_restore.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/validate_restore.py index 9b97a3004aa8..9573837d989a 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/validate_restore.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/validate_restore.py @@ -75,6 +75,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/BackupInstanceOperations/ValidateRestore.json +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/BackupInstanceOperations/ValidateRestore.json if __name__ == "__main__": main()