diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/_meta.json b/sdk/dataprotection/azure-mgmt-dataprotection/_meta.json index ec7cc250ecc3..b2eee4f3a8eb 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/_meta.json +++ b/sdk/dataprotection/azure-mgmt-dataprotection/_meta.json @@ -1,11 +1,11 @@ { - "autorest": "3.4.5", + "autorest": "3.7.2", "use": [ - "@autorest/python@5.8.4", - "@autorest/modelerfour@4.19.2" + "@autorest/python@5.13.0", + "@autorest/modelerfour@4.19.3" ], - "commit": "8d0a1bce1741e7b181746bcce6ad25dad31a3b11", + "commit": "395feffd968bd9c073bd575a4fc029b0adda57ec", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/dataprotection/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.4 --use=@autorest/modelerfour@4.19.2 --version=3.4.5", + "autorest_command": "autorest specification/dataprotection/resource-manager/readme.md --multiapi --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.13.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", "readme": "specification/dataprotection/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/__init__.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/__init__.py index 9dfda54e0346..d84c3d35d4ad 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/__init__.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['DataProtectionClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_configuration.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_configuration.py index d38b045a587e..97595eee37dd 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_configuration.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_configuration.py @@ -6,22 +6,20 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential -class DataProtectionClientConfiguration(Configuration): +class DataProtectionClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for DataProtectionClient. Note that all parameters used to create this instance are saved as instance @@ -31,24 +29,28 @@ class DataProtectionClientConfiguration(Configuration): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The subscription Id. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2022-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(DataProtectionClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(DataProtectionClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-07-01" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-dataprotection/{}'.format(VERSION)) self._configure(**kwargs) @@ -68,4 +70,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_data_protection_client.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_data_protection_client.py index 85019b92c77f..290ac8040066 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_data_protection_client.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_data_protection_client.py @@ -6,37 +6,23 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, TYPE_CHECKING -from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient -from ._configuration import DataProtectionClientConfiguration -from .operations import BackupVaultsOperations -from .operations import OperationResultOperations -from .operations import OperationStatusOperations -from .operations import BackupVaultOperationResultsOperations -from .operations import DataProtectionOperations -from .operations import DataProtectionOperationsOperations -from .operations import BackupPoliciesOperations -from .operations import BackupInstancesOperations -from .operations import RecoveryPointsOperations -from .operations import JobsOperations -from .operations import RestorableTimeRangesOperations -from .operations import ExportJobsOperations -from .operations import ExportJobsOperationResultOperations -from .operations import ResourceGuardsOperations from . import models +from ._configuration import DataProtectionClientConfiguration +from .operations import BackupInstancesOperations, BackupPoliciesOperations, BackupVaultOperationResultsOperations, BackupVaultsOperations, DataProtectionOperations, DataProtectionOperationsOperations, ExportJobsOperationResultOperations, ExportJobsOperations, JobsOperations, OperationResultOperations, OperationStatusBackupVaultContextOperations, OperationStatusOperations, OperationStatusResourceGroupContextOperations, RecoveryPointsOperations, ResourceGuardsOperations, RestorableTimeRangesOperations +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential -class DataProtectionClient(object): +class DataProtectionClient: # pylint: disable=too-many-instance-attributes """Open API 2.0 Specs for Azure Data Protection service. :ivar backup_vaults: BackupVaultsOperations operations @@ -45,12 +31,22 @@ class DataProtectionClient(object): :vartype operation_result: azure.mgmt.dataprotection.operations.OperationResultOperations :ivar operation_status: OperationStatusOperations operations :vartype operation_status: azure.mgmt.dataprotection.operations.OperationStatusOperations + :ivar operation_status_backup_vault_context: OperationStatusBackupVaultContextOperations + operations + :vartype operation_status_backup_vault_context: + azure.mgmt.dataprotection.operations.OperationStatusBackupVaultContextOperations + :ivar operation_status_resource_group_context: OperationStatusResourceGroupContextOperations + operations + :vartype operation_status_resource_group_context: + azure.mgmt.dataprotection.operations.OperationStatusResourceGroupContextOperations :ivar backup_vault_operation_results: BackupVaultOperationResultsOperations operations - :vartype backup_vault_operation_results: azure.mgmt.dataprotection.operations.BackupVaultOperationResultsOperations + :vartype backup_vault_operation_results: + azure.mgmt.dataprotection.operations.BackupVaultOperationResultsOperations :ivar data_protection: DataProtectionOperations operations :vartype data_protection: azure.mgmt.dataprotection.operations.DataProtectionOperations :ivar data_protection_operations: DataProtectionOperationsOperations operations - :vartype data_protection_operations: azure.mgmt.dataprotection.operations.DataProtectionOperationsOperations + :vartype data_protection_operations: + azure.mgmt.dataprotection.operations.DataProtectionOperationsOperations :ivar backup_policies: BackupPoliciesOperations operations :vartype backup_policies: azure.mgmt.dataprotection.operations.BackupPoliciesOperations :ivar backup_instances: BackupInstancesOperations operations @@ -60,85 +56,85 @@ class DataProtectionClient(object): :ivar jobs: JobsOperations operations :vartype jobs: azure.mgmt.dataprotection.operations.JobsOperations :ivar restorable_time_ranges: RestorableTimeRangesOperations operations - :vartype restorable_time_ranges: azure.mgmt.dataprotection.operations.RestorableTimeRangesOperations + :vartype restorable_time_ranges: + azure.mgmt.dataprotection.operations.RestorableTimeRangesOperations :ivar export_jobs: ExportJobsOperations operations :vartype export_jobs: azure.mgmt.dataprotection.operations.ExportJobsOperations :ivar export_jobs_operation_result: ExportJobsOperationResultOperations operations - :vartype export_jobs_operation_result: azure.mgmt.dataprotection.operations.ExportJobsOperationResultOperations + :vartype export_jobs_operation_result: + azure.mgmt.dataprotection.operations.ExportJobsOperationResultOperations :ivar resource_guards: ResourceGuardsOperations operations :vartype resource_guards: azure.mgmt.dataprotection.operations.ResourceGuardsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The subscription Id. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2022-04-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 + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = DataProtectionClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = DataProtectionClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = 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) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - - self.backup_vaults = BackupVaultsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operation_result = OperationResultOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operation_status = OperationStatusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.backup_vault_operation_results = BackupVaultOperationResultsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.data_protection = DataProtectionOperations( - self._client, self._config, self._serialize, self._deserialize) - self.data_protection_operations = DataProtectionOperationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.backup_policies = BackupPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.backup_instances = BackupInstancesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.recovery_points = RecoveryPointsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.jobs = JobsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.restorable_time_ranges = RestorableTimeRangesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.export_jobs = ExportJobsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.export_jobs_operation_result = ExportJobsOperationResultOperations( - self._client, self._config, self._serialize, self._deserialize) - self.resource_guards = ResourceGuardsOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + self.backup_vaults = BackupVaultsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operation_result = OperationResultOperations(self._client, self._config, self._serialize, self._deserialize) + self.operation_status = OperationStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.operation_status_backup_vault_context = OperationStatusBackupVaultContextOperations(self._client, self._config, self._serialize, self._deserialize) + self.operation_status_resource_group_context = OperationStatusResourceGroupContextOperations(self._client, self._config, self._serialize, self._deserialize) + self.backup_vault_operation_results = BackupVaultOperationResultsOperations(self._client, self._config, self._serialize, self._deserialize) + self.data_protection = DataProtectionOperations(self._client, self._config, self._serialize, self._deserialize) + self.data_protection_operations = DataProtectionOperationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.backup_policies = BackupPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.backup_instances = BackupInstancesOperations(self._client, self._config, self._serialize, self._deserialize) + self.recovery_points = RecoveryPointsOperations(self._client, self._config, self._serialize, self._deserialize) + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) + self.restorable_time_ranges = RestorableTimeRangesOperations(self._client, self._config, self._serialize, self._deserialize) + self.export_jobs = ExportJobsOperations(self._client, self._config, self._serialize, self._deserialize) + self.export_jobs_operation_result = ExportJobsOperationResultOperations(self._client, self._config, self._serialize, self._deserialize) + self.resource_guards = ResourceGuardsOperations(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. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_metadata.json b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_metadata.json index 8360a7bf7cd9..46d6dc6e3caf 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_metadata.json +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_metadata.json @@ -1,17 +1,17 @@ { - "chosen_version": "2021-07-01", - "total_api_version_list": ["2021-07-01"], + "chosen_version": "2022-04-01", + "total_api_version_list": ["2022-04-01"], "client": { "name": "DataProtectionClient", "filename": "_data_protection_client", "description": "Open API 2.0 Specs for Azure Data Protection service.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"DataProtectionClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"DataProtectionClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"DataProtectionClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"DataProtectionClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,16 +91,17 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "backup_vaults": "BackupVaultsOperations", "operation_result": "OperationResultOperations", "operation_status": "OperationStatusOperations", + "operation_status_backup_vault_context": "OperationStatusBackupVaultContextOperations", + "operation_status_resource_group_context": "OperationStatusResourceGroupContextOperations", "backup_vault_operation_results": "BackupVaultOperationResultsOperations", "data_protection": "DataProtectionOperations", "data_protection_operations": "DataProtectionOperationsOperations", diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_patch.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_vendor.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/__init__.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/__init__.py index d1235b93a84d..f32d64c4c49a 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/__init__.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/__init__.py @@ -8,3 +8,8 @@ from ._data_protection_client import DataProtectionClient __all__ = ['DataProtectionClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/_configuration.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/_configuration.py index 9fcfed8d9fab..52ba2d6d3489 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 @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class DataProtectionClientConfiguration(Configuration): +class DataProtectionClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for DataProtectionClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class DataProtectionClientConfiguration(Configuration): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The subscription Id. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2022-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -37,15 +40,17 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(DataProtectionClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(DataProtectionClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-07-01" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-dataprotection/{}'.format(VERSION)) self._configure(**kwargs) @@ -64,4 +69,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/_data_protection_client.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/_data_protection_client.py index f4ae7f1b520c..9f651b09a3b1 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/_data_protection_client.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/_data_protection_client.py @@ -6,35 +6,23 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient -from ._configuration import DataProtectionClientConfiguration -from .operations import BackupVaultsOperations -from .operations import OperationResultOperations -from .operations import OperationStatusOperations -from .operations import BackupVaultOperationResultsOperations -from .operations import DataProtectionOperations -from .operations import DataProtectionOperationsOperations -from .operations import BackupPoliciesOperations -from .operations import BackupInstancesOperations -from .operations import RecoveryPointsOperations -from .operations import JobsOperations -from .operations import RestorableTimeRangesOperations -from .operations import ExportJobsOperations -from .operations import ExportJobsOperationResultOperations -from .operations import ResourceGuardsOperations from .. import models +from ._configuration import DataProtectionClientConfiguration +from .operations import BackupInstancesOperations, BackupPoliciesOperations, BackupVaultOperationResultsOperations, BackupVaultsOperations, DataProtectionOperations, DataProtectionOperationsOperations, ExportJobsOperationResultOperations, ExportJobsOperations, JobsOperations, OperationResultOperations, OperationStatusBackupVaultContextOperations, OperationStatusOperations, OperationStatusResourceGroupContextOperations, RecoveryPointsOperations, ResourceGuardsOperations, RestorableTimeRangesOperations +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential -class DataProtectionClient(object): +class DataProtectionClient: # pylint: disable=too-many-instance-attributes """Open API 2.0 Specs for Azure Data Protection service. :ivar backup_vaults: BackupVaultsOperations operations @@ -43,12 +31,22 @@ class DataProtectionClient(object): :vartype operation_result: azure.mgmt.dataprotection.aio.operations.OperationResultOperations :ivar operation_status: OperationStatusOperations operations :vartype operation_status: azure.mgmt.dataprotection.aio.operations.OperationStatusOperations + :ivar operation_status_backup_vault_context: OperationStatusBackupVaultContextOperations + operations + :vartype operation_status_backup_vault_context: + azure.mgmt.dataprotection.aio.operations.OperationStatusBackupVaultContextOperations + :ivar operation_status_resource_group_context: OperationStatusResourceGroupContextOperations + operations + :vartype operation_status_resource_group_context: + azure.mgmt.dataprotection.aio.operations.OperationStatusResourceGroupContextOperations :ivar backup_vault_operation_results: BackupVaultOperationResultsOperations operations - :vartype backup_vault_operation_results: azure.mgmt.dataprotection.aio.operations.BackupVaultOperationResultsOperations + :vartype backup_vault_operation_results: + azure.mgmt.dataprotection.aio.operations.BackupVaultOperationResultsOperations :ivar data_protection: DataProtectionOperations operations :vartype data_protection: azure.mgmt.dataprotection.aio.operations.DataProtectionOperations :ivar data_protection_operations: DataProtectionOperationsOperations operations - :vartype data_protection_operations: azure.mgmt.dataprotection.aio.operations.DataProtectionOperationsOperations + :vartype data_protection_operations: + azure.mgmt.dataprotection.aio.operations.DataProtectionOperationsOperations :ivar backup_policies: BackupPoliciesOperations operations :vartype backup_policies: azure.mgmt.dataprotection.aio.operations.BackupPoliciesOperations :ivar backup_instances: BackupInstancesOperations operations @@ -58,83 +56,85 @@ class DataProtectionClient(object): :ivar jobs: JobsOperations operations :vartype jobs: azure.mgmt.dataprotection.aio.operations.JobsOperations :ivar restorable_time_ranges: RestorableTimeRangesOperations operations - :vartype restorable_time_ranges: azure.mgmt.dataprotection.aio.operations.RestorableTimeRangesOperations + :vartype restorable_time_ranges: + azure.mgmt.dataprotection.aio.operations.RestorableTimeRangesOperations :ivar export_jobs: ExportJobsOperations operations :vartype export_jobs: azure.mgmt.dataprotection.aio.operations.ExportJobsOperations :ivar export_jobs_operation_result: ExportJobsOperationResultOperations operations - :vartype export_jobs_operation_result: azure.mgmt.dataprotection.aio.operations.ExportJobsOperationResultOperations + :vartype export_jobs_operation_result: + azure.mgmt.dataprotection.aio.operations.ExportJobsOperationResultOperations :ivar resource_guards: ResourceGuardsOperations operations :vartype resource_guards: azure.mgmt.dataprotection.aio.operations.ResourceGuardsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The subscription Id. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2022-04-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 + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = DataProtectionClientConfiguration(credential, subscription_id, **kwargs) + self._config = DataProtectionClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = 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) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.backup_vaults = BackupVaultsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operation_result = OperationResultOperations(self._client, self._config, self._serialize, self._deserialize) + self.operation_status = OperationStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.operation_status_backup_vault_context = OperationStatusBackupVaultContextOperations(self._client, self._config, self._serialize, self._deserialize) + self.operation_status_resource_group_context = OperationStatusResourceGroupContextOperations(self._client, self._config, self._serialize, self._deserialize) + self.backup_vault_operation_results = BackupVaultOperationResultsOperations(self._client, self._config, self._serialize, self._deserialize) + self.data_protection = DataProtectionOperations(self._client, self._config, self._serialize, self._deserialize) + self.data_protection_operations = DataProtectionOperationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.backup_policies = BackupPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.backup_instances = BackupInstancesOperations(self._client, self._config, self._serialize, self._deserialize) + self.recovery_points = RecoveryPointsOperations(self._client, self._config, self._serialize, self._deserialize) + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) + self.restorable_time_ranges = RestorableTimeRangesOperations(self._client, self._config, self._serialize, self._deserialize) + self.export_jobs = ExportJobsOperations(self._client, self._config, self._serialize, self._deserialize) + self.export_jobs_operation_result = ExportJobsOperationResultOperations(self._client, self._config, self._serialize, self._deserialize) + self.resource_guards = ResourceGuardsOperations(self._client, self._config, self._serialize, self._deserialize) - self.backup_vaults = BackupVaultsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operation_result = OperationResultOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operation_status = OperationStatusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.backup_vault_operation_results = BackupVaultOperationResultsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.data_protection = DataProtectionOperations( - self._client, self._config, self._serialize, self._deserialize) - self.data_protection_operations = DataProtectionOperationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.backup_policies = BackupPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.backup_instances = BackupInstancesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.recovery_points = RecoveryPointsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.jobs = JobsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.restorable_time_ranges = RestorableTimeRangesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.export_jobs = ExportJobsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.export_jobs_operation_result = ExportJobsOperationResultOperations( - self._client, self._config, self._serialize, self._deserialize) - self.resource_guards = ResourceGuardsOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/_patch.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file 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 f9c765bb82a0..bf5d55f651c4 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 @@ -9,6 +9,8 @@ from ._backup_vaults_operations import BackupVaultsOperations from ._operation_result_operations import OperationResultOperations from ._operation_status_operations import OperationStatusOperations +from ._operation_status_backup_vault_context_operations import OperationStatusBackupVaultContextOperations +from ._operation_status_resource_group_context_operations import OperationStatusResourceGroupContextOperations from ._backup_vault_operation_results_operations import BackupVaultOperationResultsOperations from ._data_protection_operations import DataProtectionOperations from ._data_protection_operations_operations import DataProtectionOperationsOperations @@ -25,6 +27,8 @@ 'BackupVaultsOperations', 'OperationResultOperations', 'OperationStatusOperations', + 'OperationStatusBackupVaultContextOperations', + 'OperationStatusResourceGroupContextOperations', 'BackupVaultOperationResultsOperations', 'DataProtectionOperations', 'DataProtectionOperationsOperations', 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 ff56d2bc2e8d..1029cefafee2 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_instances_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_instances_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,26 @@ # 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, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._backup_instances_operations import build_adhoc_backup_request_initial, build_create_or_update_request_initial, build_delete_request_initial, build_get_backup_instance_operation_result_request, build_get_request, build_list_request, build_resume_backups_request_initial, build_resume_protection_request_initial, build_stop_protection_request_initial, build_suspend_backups_request_initial, build_sync_backup_instance_request_initial, build_trigger_rehydrate_request_initial, build_trigger_restore_request_initial, build_validate_for_backup_request_initial, build_validate_for_restore_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class BackupInstancesOperations: +class BackupInstancesOperations: # pylint: disable=too-many-public-methods """BackupInstancesOperations async operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -43,58 +47,62 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - vault_name: str, resource_group_name: str, + vault_name: str, **kwargs: Any ) -> AsyncIterable["_models.BackupInstanceResourceList"]: """Gets a backup instances belonging to a backup vault. - :param vault_name: The name of the backup vault. - :type vault_name: str :param resource_group_name: The name of the resource group where the backup vault is present. :type resource_group_name: str + :param vault_name: The name of the backup vault. + :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 BackupInstanceResourceList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.BackupInstanceResourceList] + :return: An iterator like instance of either BackupInstanceResourceList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.BackupInstanceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupInstanceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('BackupInstanceResourceList', pipeline_response) + deserialized = self._deserialize("BackupInstanceResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,7 +111,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -112,24 +124,26 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances"} # type: ignore + @distributed_trace_async async def get( self, - vault_name: str, resource_group_name: str, + vault_name: str, backup_instance_name: str, **kwargs: Any ) -> "_models.BackupInstanceResource": """Gets a backup instance with name in a backup vault. - :param vault_name: The name of the backup vault. - :type vault_name: str :param resource_group_name: The name of the resource group where the backup vault is present. :type resource_group_name: str + :param vault_name: The name of the backup vault. + :type vault_name: str :param backup_instance_name: The name of the backup instance. :type backup_instance_name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -142,29 +156,26 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'backupInstanceName': self._serialize.url("backup_instance_name", backup_instance_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-04-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -177,95 +188,109 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}"} # type: ignore + async def _create_or_update_initial( self, - vault_name: str, resource_group_name: str, + vault_name: str, backup_instance_name: str, parameters: "_models.BackupInstanceResource", **kwargs: Any - ) -> "_models.BackupInstanceResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupInstanceResource"] + ) -> Optional["_models.BackupInstanceResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.BackupInstanceResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'backupInstanceName': self._serialize.url("backup_instance_name", backup_instance_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BackupInstanceResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'BackupInstanceResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200, 201, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize('BackupInstanceResource', pipeline_response) if response.status_code == 201: deserialized = self._deserialize('BackupInstanceResource', pipeline_response) + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}"} # type: ignore + + + @distributed_trace_async async def begin_create_or_update( self, - vault_name: str, resource_group_name: str, + vault_name: str, backup_instance_name: str, parameters: "_models.BackupInstanceResource", **kwargs: Any ) -> AsyncLROPoller["_models.BackupInstanceResource"]: """Create or update a backup instance in a backup vault. - :param vault_name: The name of the backup vault. - :type vault_name: str :param resource_group_name: The name of the resource group where the backup vault is present. :type resource_group_name: str + :param vault_name: The name of the backup vault. + :type vault_name: str :param backup_instance_name: The name of the backup instance. :type backup_instance_name: str :param parameters: Request body for operation. :type parameters: ~azure.mgmt.dataprotection.models.BackupInstanceResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either BackupInstanceResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.BackupInstanceResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BackupInstanceResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.BackupInstanceResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupInstanceResource"] lro_delay = kwargs.pop( @@ -275,32 +300,26 @@ async def begin_create_or_update( cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( - vault_name=vault_name, resource_group_name=resource_group_name, + vault_name=vault_name, backup_instance_name=backup_instance_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BackupInstanceResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'backupInstanceName': self._serialize.url("backup_instance_name", backup_instance_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -310,14 +329,14 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, - vault_name: str, resource_group_name: str, + vault_name: str, backup_instance_name: str, **kwargs: Any ) -> None: @@ -326,29 +345,26 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'backupInstanceName': self._serialize.url("backup_instance_name", backup_instance_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-04-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -360,37 +376,43 @@ async def _delete_initial( response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}"} # type: ignore + - async def begin_delete( + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, - vault_name: str, resource_group_name: str, + vault_name: str, backup_instance_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Delete a backup instance in a backup vault. - :param vault_name: The name of the backup vault. - :type vault_name: str :param resource_group_name: The name of the resource group where the backup vault is present. :type resource_group_name: str + :param vault_name: The name of the backup vault. + :type vault_name: str :param backup_instance_name: The name of the backup instance. :type backup_instance_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -400,28 +422,21 @@ async def begin_delete( cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( - vault_name=vault_name, resource_group_name=resource_group_name, + vault_name=vault_name, backup_instance_name=backup_instance_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'backupInstanceName': self._serialize.url("backup_instance_name", backup_instance_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -431,14 +446,14 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}"} # type: ignore async def _adhoc_backup_initial( self, - vault_name: str, resource_group_name: str, + vault_name: str, backup_instance_name: str, parameters: "_models.TriggerBackupRequest", **kwargs: Any @@ -448,42 +463,38 @@ async def _adhoc_backup_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._adhoc_backup_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'backupInstanceName': self._serialize.url("backup_instance_name", backup_instance_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'TriggerBackupRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'TriggerBackupRequest') + + request = build_adhoc_backup_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._adhoc_backup_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize('OperationJobExtendedInfo', pipeline_response) @@ -491,41 +502,51 @@ async def _adhoc_backup_initial( response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _adhoc_backup_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/backup'} # type: ignore + _adhoc_backup_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/backup"} # type: ignore + + + @distributed_trace_async async def begin_adhoc_backup( self, - vault_name: str, resource_group_name: str, + vault_name: str, backup_instance_name: str, parameters: "_models.TriggerBackupRequest", **kwargs: Any ) -> AsyncLROPoller["_models.OperationJobExtendedInfo"]: """Trigger adhoc backup. - :param vault_name: The name of the backup vault. - :type vault_name: str :param resource_group_name: The name of the resource group where the backup vault is present. :type resource_group_name: str + :param vault_name: The name of the backup vault. + :type vault_name: str :param backup_instance_name: The name of the backup instance. :type backup_instance_name: str :param parameters: Request body for operation. :type parameters: ~azure.mgmt.dataprotection.models.TriggerBackupRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationJobExtendedInfo or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationJobExtendedInfo or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationJobExtendedInfo"] lro_delay = kwargs.pop( @@ -535,32 +556,26 @@ async def begin_adhoc_backup( cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._adhoc_backup_initial( - vault_name=vault_name, resource_group_name=resource_group_name, + vault_name=vault_name, backup_instance_name=backup_instance_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationJobExtendedInfo', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'backupInstanceName': self._serialize.url("backup_instance_name", backup_instance_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -570,14 +585,14 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_adhoc_backup.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/backup'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_adhoc_backup.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/backup"} # type: ignore async def _validate_for_backup_initial( self, - vault_name: str, resource_group_name: str, + vault_name: str, parameters: "_models.ValidateForBackupRequest", **kwargs: Any ) -> Optional["_models.OperationJobExtendedInfo"]: @@ -586,41 +601,37 @@ async def _validate_for_backup_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._validate_for_backup_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ValidateForBackupRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ValidateForBackupRequest') + + request = build_validate_for_backup_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._validate_for_backup_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize('OperationJobExtendedInfo', pipeline_response) @@ -628,38 +639,48 @@ async def _validate_for_backup_initial( response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _validate_for_backup_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/validateForBackup'} # type: ignore + _validate_for_backup_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/validateForBackup"} # type: ignore + + + @distributed_trace_async async def begin_validate_for_backup( self, - vault_name: str, resource_group_name: str, + vault_name: str, parameters: "_models.ValidateForBackupRequest", **kwargs: Any ) -> AsyncLROPoller["_models.OperationJobExtendedInfo"]: """Validate whether adhoc backup will be successful or not. - :param vault_name: The name of the backup vault. - :type vault_name: str :param resource_group_name: The name of the resource group where the backup vault is present. :type resource_group_name: str + :param vault_name: The name of the backup vault. + :type vault_name: str :param parameters: Request body for operation. :type parameters: ~azure.mgmt.dataprotection.models.ValidateForBackupRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationJobExtendedInfo or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationJobExtendedInfo or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationJobExtendedInfo"] lro_delay = kwargs.pop( @@ -669,30 +690,25 @@ async def begin_validate_for_backup( cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._validate_for_backup_initial( - vault_name=vault_name, resource_group_name=resource_group_name, + vault_name=vault_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationJobExtendedInfo', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -702,11 +718,79 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_validate_for_backup.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/validateForBackup'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_validate_for_backup.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/validateForBackup"} # type: ignore + + @distributed_trace_async + async def get_backup_instance_operation_result( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + operation_id: str, + **kwargs: Any + ) -> Optional["_models.BackupInstanceResource"]: + """Get result of backup instance creation operation. + + :param resource_group_name: The name of the resource group where the backup vault is present. + :type resource_group_name: str + :param vault_name: The name of the backup vault. + :type vault_name: str + :param backup_instance_name: + :type backup_instance_name: str + :param operation_id: + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupInstanceResource, or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.BackupInstanceResource or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.BackupInstanceResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_backup_instance_operation_result_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + operation_id=operation_id, + api_version=api_version, + template_url=self.get_backup_instance_operation_result.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('BackupInstanceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_backup_instance_operation_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/operationResults/{operationId}"} # type: ignore - async def _trigger_rehydrate_initial( + + async def _trigger_rehydrate_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vault_name: str, @@ -719,34 +803,30 @@ async def _trigger_rehydrate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._trigger_rehydrate_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'backupInstanceName': self._serialize.url("backup_instance_name", backup_instance_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'AzureBackupRehydrationRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'AzureBackupRehydrationRequest') + + request = build_trigger_rehydrate_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._trigger_rehydrate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -758,13 +838,16 @@ async def _trigger_rehydrate_initial( response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _trigger_rehydrate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/rehydrate'} # type: ignore + _trigger_rehydrate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/rehydrate"} # type: ignore - async def begin_trigger_rehydrate( + + @distributed_trace_async + async def begin_trigger_rehydrate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vault_name: str, @@ -784,14 +867,18 @@ async def begin_trigger_rehydrate( :type parameters: ~azure.mgmt.dataprotection.models.AzureBackupRehydrationRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -805,25 +892,19 @@ async def begin_trigger_rehydrate( vault_name=vault_name, backup_instance_name=backup_instance_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'backupInstanceName': self._serialize.url("backup_instance_name", backup_instance_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -833,14 +914,14 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_trigger_rehydrate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/rehydrate'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_trigger_rehydrate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/rehydrate"} # type: ignore async def _trigger_restore_initial( self, - vault_name: str, resource_group_name: str, + vault_name: str, backup_instance_name: str, parameters: "_models.AzureBackupRestoreRequest", **kwargs: Any @@ -850,42 +931,38 @@ async def _trigger_restore_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._trigger_restore_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'backupInstanceName': self._serialize.url("backup_instance_name", backup_instance_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'AzureBackupRestoreRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'AzureBackupRestoreRequest') + + request = build_trigger_restore_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._trigger_restore_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize('OperationJobExtendedInfo', pipeline_response) @@ -893,41 +970,51 @@ async def _trigger_restore_initial( response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _trigger_restore_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/restore'} # type: ignore + _trigger_restore_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/restore"} # type: ignore + + + @distributed_trace_async async def begin_trigger_restore( self, - vault_name: str, resource_group_name: str, + vault_name: str, backup_instance_name: str, parameters: "_models.AzureBackupRestoreRequest", **kwargs: Any ) -> AsyncLROPoller["_models.OperationJobExtendedInfo"]: """Triggers restore for a BackupInstance. - :param vault_name: The name of the backup vault. - :type vault_name: str :param resource_group_name: The name of the resource group where the backup vault is present. :type resource_group_name: str + :param vault_name: The name of the backup vault. + :type vault_name: str :param backup_instance_name: The name of the backup instance. :type backup_instance_name: str :param parameters: Request body for operation. :type parameters: ~azure.mgmt.dataprotection.models.AzureBackupRestoreRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationJobExtendedInfo or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationJobExtendedInfo or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationJobExtendedInfo"] lro_delay = kwargs.pop( @@ -937,32 +1024,26 @@ async def begin_trigger_restore( cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._trigger_restore_initial( - vault_name=vault_name, resource_group_name=resource_group_name, + vault_name=vault_name, backup_instance_name=backup_instance_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationJobExtendedInfo', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'backupInstanceName': self._serialize.url("backup_instance_name", backup_instance_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -972,51 +1053,42 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_trigger_restore.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/restore'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _validate_for_restore_initial( + begin_trigger_restore.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/restore"} # type: ignore + + async def _resume_backups_initial( # pylint: disable=inconsistent-return-statements self, - vault_name: str, resource_group_name: str, + vault_name: str, backup_instance_name: str, - parameters: "_models.ValidateRestoreRequestObject", **kwargs: Any - ) -> Optional["_models.OperationJobExtendedInfo"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationJobExtendedInfo"]] + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._validate_for_restore_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'backupInstanceName': self._serialize.url("backup_instance_name", backup_instance_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ValidateRestoreRequestObject') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_resume_backups_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + api_version=api_version, + template_url=self._resume_backups_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1024,84 +1096,690 @@ async def _validate_for_restore_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('OperationJobExtendedInfo', pipeline_response) - if response.status_code == 202: response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, None, response_headers) - return deserialized - _validate_for_restore_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/validateRestore'} # type: ignore + _resume_backups_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/resumeBackups"} # type: ignore - async def begin_validate_for_restore( + + @distributed_trace_async + async def begin_resume_backups( # pylint: disable=inconsistent-return-statements self, - vault_name: str, resource_group_name: str, + vault_name: str, backup_instance_name: str, - parameters: "_models.ValidateRestoreRequestObject", **kwargs: Any - ) -> AsyncLROPoller["_models.OperationJobExtendedInfo"]: - """Validates if Restore can be triggered for a DataSource. + ) -> AsyncLROPoller[None]: + """This operation will resume backups for backup instance. - :param vault_name: The name of the backup vault. - :type vault_name: str :param resource_group_name: The name of the resource group where the backup vault is present. :type resource_group_name: str - :param backup_instance_name: The name of the backup instance. + :param vault_name: The name of the backup vault. + :type vault_name: str + :param backup_instance_name: :type backup_instance_name: str - :param parameters: Request body for operation. - :type parameters: ~azure.mgmt.dataprotection.models.ValidateRestoreRequestObject :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationJobExtendedInfo or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationJobExtendedInfo"] + cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._validate_for_restore_initial( - vault_name=vault_name, + raw_result = await self._resume_backups_initial( resource_group_name=resource_group_name, + vault_name=vault_name, backup_instance_name=backup_instance_name, - parameters=parameters, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_resume_backups.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/resumeBackups"} # type: ignore + + async def _resume_protection_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_resume_protection_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + api_version=api_version, + template_url=self._resume_protection_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + + if cls: + return cls(pipeline_response, None, response_headers) + + _resume_protection_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/resumeProtection"} # type: ignore + + + @distributed_trace_async + async def begin_resume_protection( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """This operation will resume protection for a stopped backup instance. + :param resource_group_name: The name of the resource group where the backup vault is present. + :type resource_group_name: str + :param vault_name: The name of the backup vault. + :type vault_name: str + :param backup_instance_name: + :type backup_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._resume_protection_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_resume_protection.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/resumeProtection"} # type: ignore + + async def _stop_protection_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_stop_protection_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + api_version=api_version, + template_url=self._stop_protection_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + + if cls: + return cls(pipeline_response, None, response_headers) + + _stop_protection_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/stopProtection"} # type: ignore + + + @distributed_trace_async + async def begin_stop_protection( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """This operation will stop protection of a backup instance and data will be held forever. + + :param resource_group_name: The name of the resource group where the backup vault is present. + :type resource_group_name: str + :param vault_name: The name of the backup vault. + :type vault_name: str + :param backup_instance_name: + :type backup_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._stop_protection_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_stop_protection.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/stopProtection"} # type: ignore + + async def _suspend_backups_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_suspend_backups_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + api_version=api_version, + template_url=self._suspend_backups_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + + if cls: + return cls(pipeline_response, None, response_headers) + + _suspend_backups_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/suspendBackups"} # type: ignore + + + @distributed_trace_async + async def begin_suspend_backups( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """This operation will stop backups for backup instance. + + :param resource_group_name: The name of the resource group where the backup vault is present. + :type resource_group_name: str + :param vault_name: The name of the backup vault. + :type vault_name: str + :param backup_instance_name: + :type backup_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._suspend_backups_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_suspend_backups.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/suspendBackups"} # type: ignore + + async def _sync_backup_instance_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: "_models.SyncBackupInstanceRequest", + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'SyncBackupInstanceRequest') + + request = build_sync_backup_instance_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._sync_backup_instance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + + if cls: + return cls(pipeline_response, None, response_headers) + + _sync_backup_instance_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/sync"} # type: ignore + + + @distributed_trace_async + async def begin_sync_backup_instance( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: "_models.SyncBackupInstanceRequest", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Sync backup instance again in case of failure + This action will retry last failed operation and will bring backup instance to valid state. + + :param resource_group_name: The name of the resource group where the backup vault is present. + :type resource_group_name: str + :param vault_name: The name of the backup vault. + :type vault_name: str + :param backup_instance_name: + :type backup_instance_name: str + :param parameters: Request body for operation. + :type parameters: ~azure.mgmt.dataprotection.models.SyncBackupInstanceRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._sync_backup_instance_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_sync_backup_instance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/sync"} # type: ignore + + async def _validate_for_restore_initial( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: "_models.ValidateRestoreRequestObject", + **kwargs: Any + ) -> Optional["_models.OperationJobExtendedInfo"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationJobExtendedInfo"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ValidateRestoreRequestObject') + + request = build_validate_for_restore_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._validate_for_restore_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: deserialized = self._deserialize('OperationJobExtendedInfo', pipeline_response) + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _validate_for_restore_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/validateRestore"} # type: ignore + + + @distributed_trace_async + async def begin_validate_for_restore( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: "_models.ValidateRestoreRequestObject", + **kwargs: Any + ) -> AsyncLROPoller["_models.OperationJobExtendedInfo"]: + """Validates if Restore can be triggered for a DataSource. + + :param resource_group_name: The name of the resource group where the backup vault is present. + :type resource_group_name: str + :param vault_name: The name of the backup vault. + :type vault_name: str + :param backup_instance_name: The name of the backup instance. + :type backup_instance_name: str + :param parameters: Request body for operation. + :type parameters: ~azure.mgmt.dataprotection.models.ValidateRestoreRequestObject + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationJobExtendedInfo or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationJobExtendedInfo"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._validate_for_restore_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('OperationJobExtendedInfo', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'backupInstanceName': self._serialize.url("backup_instance_name", backup_instance_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1111,6 +1789,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_validate_for_restore.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/validateRestore'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_validate_for_restore.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/validateRestore"} # type: ignore 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 3b220c4d6253..cc2e75655735 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_policies_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_policies_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,20 @@ # 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, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +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.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._backup_policies_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,58 +45,62 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - vault_name: str, resource_group_name: str, + vault_name: str, **kwargs: Any ) -> AsyncIterable["_models.BaseBackupPolicyResourceList"]: """Returns list of backup policies belonging to a backup vault. - :param vault_name: The name of the backup vault. - :type vault_name: str :param resource_group_name: The name of the resource group where the backup vault is present. :type resource_group_name: str + :param vault_name: The name of the backup vault. + :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 BaseBackupPolicyResourceList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.BaseBackupPolicyResourceList] + :return: An iterator like instance of either BaseBackupPolicyResourceList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.BaseBackupPolicyResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.BaseBackupPolicyResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + api_version=api_version, + template_url=next_link, + ) + 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('BaseBackupPolicyResourceList', pipeline_response) + deserialized = self._deserialize("BaseBackupPolicyResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -101,7 +109,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -110,15 +122,17 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies"} # type: ignore + @distributed_trace_async async def get( self, - vault_name: str, resource_group_name: str, + vault_name: str, backup_policy_name: str, **kwargs: Any ) -> "_models.BaseBackupPolicyResource": @@ -126,10 +140,10 @@ async def get( Gets a backup policy belonging to a backup vault. - :param vault_name: The name of the backup vault. - :type vault_name: str :param resource_group_name: The name of the resource group where the backup vault is present. :type resource_group_name: str + :param vault_name: The name of the backup vault. + :type vault_name: str :param backup_policy_name: :type backup_policy_name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -142,29 +156,26 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'backupPolicyName': self._serialize.url("backup_policy_name", backup_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-04-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_policy_name=backup_policy_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -177,12 +188,15 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}"} # type: ignore + + + @distributed_trace_async async def create_or_update( self, - vault_name: str, resource_group_name: str, + vault_name: str, backup_policy_name: str, parameters: "_models.BaseBackupPolicyResource", **kwargs: Any @@ -191,10 +205,10 @@ async def create_or_update( Creates or Updates a backup policy belonging to a backup vault. - :param vault_name: The name of the backup vault. - :type vault_name: str :param resource_group_name: The name of the resource group where the backup vault is present. :type resource_group_name: str + :param vault_name: The name of the backup vault. + :type vault_name: str :param backup_policy_name: Name of the policy. :type backup_policy_name: str :param parameters: Request body for operation. @@ -209,34 +223,30 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'backupPolicyName': self._serialize.url("backup_policy_name", backup_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BaseBackupPolicyResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'BaseBackupPolicyResource') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_policy_name=backup_policy_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -249,12 +259,15 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}'} # type: ignore - async def delete( + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}"} # type: ignore + + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements self, - vault_name: str, resource_group_name: str, + vault_name: str, backup_policy_name: str, **kwargs: Any ) -> None: @@ -262,10 +275,10 @@ async def delete( Deletes a backup policy belonging to a backup vault. - :param vault_name: The name of the backup vault. - :type vault_name: str :param resource_group_name: The name of the resource group where the backup vault is present. :type resource_group_name: str + :param vault_name: The name of the backup vault. + :type vault_name: str :param backup_policy_name: :type backup_policy_name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -278,29 +291,26 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'backupPolicyName': self._serialize.url("backup_policy_name", backup_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-04-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_policy_name=backup_policy_name, + api_version=api_version, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -310,4 +320,5 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}"} # type: ignore + 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 22c61b0cc12b..57971200d2a8 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_vault_operation_results_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_vault_operation_results_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,16 +6,18 @@ # 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, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._backup_vault_operation_results_operations import build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,19 +43,20 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, - vault_name: str, resource_group_name: str, + vault_name: str, operation_id: str, **kwargs: Any ) -> Optional["_models.BackupVaultResource"]: """get. - :param vault_name: The name of the backup vault. - :type vault_name: str :param resource_group_name: The name of the resource group where the backup vault is present. :type resource_group_name: str + :param vault_name: The name of the backup vault. + :type vault_name: str :param operation_id: :type operation_id: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -65,37 +69,34 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + operation_id=operation_id, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize('BackupVaultResource', pipeline_response) @@ -103,9 +104,12 @@ async def get( response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/operationResults/{operationId}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/operationResults/{operationId}"} # type: ignore + 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 d0bc61275c7b..51e7251b8405 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_vaults_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_vaults_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,19 +6,22 @@ # 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, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._backup_vaults_operations import build_check_name_availability_request, build_create_or_update_request_initial, build_delete_request, build_get_in_resource_group_request, build_get_in_subscription_request, build_get_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +47,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def get_in_subscription( self, **kwargs: Any @@ -50,43 +55,44 @@ def get_in_subscription( """Returns resource collection belonging to a subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BackupVaultResourceList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.BackupVaultResourceList] + :return: An iterator like instance of either BackupVaultResourceList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.BackupVaultResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupVaultResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.get_in_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_in_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_in_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_in_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + 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('BackupVaultResourceList', pipeline_response) + deserialized = self._deserialize("BackupVaultResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -95,7 +101,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -104,11 +114,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - get_in_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/backupVaults'} # type: ignore + get_in_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/backupVaults"} # type: ignore + @distributed_trace def get_in_resource_group( self, resource_group_name: str, @@ -119,44 +131,46 @@ def get_in_resource_group( :param resource_group_name: The name of the resource group where the backup vault is present. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BackupVaultResourceList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.BackupVaultResourceList] + :return: An iterator like instance of either BackupVaultResourceList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.BackupVaultResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupVaultResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.get_in_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_in_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_in_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_in_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + 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('BackupVaultResourceList', pipeline_response) + deserialized = self._deserialize("BackupVaultResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -165,7 +179,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -174,23 +192,25 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - get_in_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults'} # type: ignore + get_in_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults"} # type: ignore + @distributed_trace_async async def get( self, - vault_name: str, resource_group_name: str, + vault_name: str, **kwargs: Any ) -> "_models.BackupVaultResource": """Returns a resource belonging to a resource group. - :param vault_name: The name of the backup vault. - :type vault_name: str :param resource_group_name: The name of the resource group where the backup vault is present. :type resource_group_name: str + :param vault_name: The name of the backup vault. + :type vault_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: BackupVaultResource, or the result of cls(response) :rtype: ~azure.mgmt.dataprotection.models.BackupVaultResource @@ -201,28 +221,25 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-04-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -235,12 +252,14 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}"} # type: ignore + async def _create_or_update_initial( self, - vault_name: str, resource_group_name: str, + vault_name: str, parameters: "_models.BackupVaultResource", **kwargs: Any ) -> "_models.BackupVaultResource": @@ -249,33 +268,29 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BackupVaultResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'BackupVaultResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -292,33 +307,42 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}"} # type: ignore + + + @distributed_trace_async async def begin_create_or_update( self, - vault_name: str, resource_group_name: str, + vault_name: str, parameters: "_models.BackupVaultResource", **kwargs: Any ) -> AsyncLROPoller["_models.BackupVaultResource"]: """Creates or updates a BackupVault resource belonging to a resource group. - :param vault_name: The name of the backup vault. - :type vault_name: str :param resource_group_name: The name of the resource group where the backup vault is present. :type resource_group_name: str + :param vault_name: The name of the backup vault. + :type vault_name: str :param parameters: Request body for operation. :type parameters: ~azure.mgmt.dataprotection.models.BackupVaultResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either BackupVaultResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.BackupVaultResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BackupVaultResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.BackupVaultResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupVaultResource"] lro_delay = kwargs.pop( @@ -328,30 +352,25 @@ async def begin_create_or_update( cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( - vault_name=vault_name, resource_group_name=resource_group_name, + vault_name=vault_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BackupVaultResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -361,22 +380,23 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}"} # type: ignore - async def delete( + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements self, - vault_name: str, resource_group_name: str, + vault_name: str, **kwargs: Any ) -> None: """Deletes a BackupVault resource from the resource group. - :param vault_name: The name of the backup vault. - :type vault_name: str :param resource_group_name: The name of the resource group where the backup vault is present. :type resource_group_name: str + :param vault_name: The name of the backup vault. + :type vault_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 @@ -387,28 +407,25 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-04-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + api_version=api_version, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -418,12 +435,13 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}"} # type: ignore + async def _update_initial( self, - vault_name: str, resource_group_name: str, + vault_name: str, parameters: "_models.PatchResourceRequestInput", **kwargs: Any ) -> Optional["_models.BackupVaultResource"]: @@ -432,33 +450,29 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'PatchResourceRequestInput') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'PatchResourceRequestInput') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -473,34 +487,43 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}"} # type: ignore + + + @distributed_trace_async async def begin_update( self, - vault_name: str, resource_group_name: str, + vault_name: str, parameters: "_models.PatchResourceRequestInput", **kwargs: Any ) -> AsyncLROPoller["_models.BackupVaultResource"]: """Updates a BackupVault resource belonging to a resource group. For example, updating tags for a resource. - :param vault_name: The name of the backup vault. - :type vault_name: str :param resource_group_name: The name of the resource group where the backup vault is present. :type resource_group_name: str + :param vault_name: The name of the backup vault. + :type vault_name: str :param parameters: Request body for operation. :type parameters: ~azure.mgmt.dataprotection.models.PatchResourceRequestInput :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either BackupVaultResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.BackupVaultResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BackupVaultResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.BackupVaultResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupVaultResource"] lro_delay = kwargs.pop( @@ -510,30 +533,25 @@ async def begin_update( cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._update_initial( - vault_name=vault_name, resource_group_name=resource_group_name, + vault_name=vault_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BackupVaultResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -543,10 +561,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}"} # type: ignore + @distributed_trace_async async def check_name_availability( self, resource_group_name: str, @@ -574,33 +593,29 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CheckNameAvailabilityRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'CheckNameAvailabilityRequest') + + request = build_check_name_availability_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + location=location, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -613,4 +628,6 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/locations/{location}/checkNameAvailability'} # type: ignore + + check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/locations/{location}/checkNameAvailability"} # type: ignore + diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_data_protection_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_data_protection_operations.py index 4f4c02a41fbf..b0fca7e32c1b 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_data_protection_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_data_protection_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,16 +6,18 @@ # 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, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._data_protection_operations import build_check_feature_support_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +43,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def check_feature_support( self, location: str, @@ -64,32 +68,28 @@ async def check_feature_support( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_feature_support.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'FeatureValidationRequestBase') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'FeatureValidationRequestBase') + + request = build_check_feature_support_request( + subscription_id=self._config.subscription_id, + location=location, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.check_feature_support.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -102,4 +102,6 @@ async def check_feature_support( return cls(pipeline_response, deserialized, {}) return deserialized - check_feature_support.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/locations/{location}/checkFeatureSupport'} # type: ignore + + check_feature_support.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/locations/{location}/checkFeatureSupport"} # type: ignore + diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_data_protection_operations_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_data_protection_operations_operations.py index c214a878307e..d3b8b6639316 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_data_protection_operations_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_data_protection_operations_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,19 @@ # 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, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._data_protection_operations_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -48,39 +52,42 @@ def list( """Returns the list of available operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ClientDiscoveryResponse or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.ClientDiscoveryResponse] + :return: An iterator like instance of either ClientDiscoveryResponse or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.ClientDiscoveryResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ClientDiscoveryResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + api_version=api_version, + template_url=next_link, + ) + 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('ClientDiscoveryResponse', pipeline_response) + deserialized = self._deserialize("ClientDiscoveryResponse", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -89,7 +96,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -98,7 +109,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.DataProtection/operations'} # type: ignore + list.metadata = {'url': "/providers/Microsoft.DataProtection/operations"} # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_export_jobs_operation_result_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_export_jobs_operation_result_operations.py index 5229fa069641..ccd920df4b9a 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_export_jobs_operation_result_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_export_jobs_operation_result_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,16 +6,18 @@ # 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, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._export_jobs_operation_result_operations import build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +43,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -67,29 +71,26 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + operation_id=operation_id, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -104,4 +105,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs/operations/{operationId}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs/operations/{operationId}"} # type: ignore + diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_export_jobs_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_export_jobs_operations.py index 9e54054ad0ea..adb2527c7b7f 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_export_jobs_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_export_jobs_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,18 +6,20 @@ # 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, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._export_jobs_operations import build_trigger_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +45,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - async def _trigger_initial( + async def _trigger_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vault_name: str, @@ -53,28 +56,25 @@ async def _trigger_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self._trigger_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-04-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_trigger_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + api_version=api_version, + template_url=self._trigger_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -85,13 +85,16 @@ async def _trigger_initial( if response.status_code == 202: response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _trigger_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/exportBackupJobs'} # type: ignore + _trigger_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/exportBackupJobs"} # type: ignore - async def begin_trigger( + + @distributed_trace_async + async def begin_trigger( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vault_name: str, @@ -105,14 +108,17 @@ async def begin_trigger( :type vault_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -124,24 +130,18 @@ async def begin_trigger( raw_result = await self._trigger_initial( resource_group_name=resource_group_name, vault_name=vault_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -151,6 +151,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_trigger.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/exportBackupJobs'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_trigger.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/exportBackupJobs"} # type: ignore 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 8cce9e55bcfc..57d57faaab9c 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_jobs_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_jobs_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,20 @@ # 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, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +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.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._jobs_operations import build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +45,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -54,45 +59,48 @@ def list( :param vault_name: The name of the backup vault. :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 AzureBackupJobResourceList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.AzureBackupJobResourceList] + :return: An iterator like instance of either AzureBackupJobResourceList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.AzureBackupJobResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AzureBackupJobResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AzureBackupJobResourceList', pipeline_response) + deserialized = self._deserialize("AzureBackupJobResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -101,7 +109,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -110,11 +122,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs"} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -141,29 +155,26 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'jobId': self._serialize.url("job_id", job_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-04-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + job_id=job_id, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -176,4 +187,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs/{jobId}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs/{jobId}"} # type: ignore + diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_result_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_result_operations.py index 4793f47b4c57..c5dfca962349 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_result_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_result_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,16 +6,18 @@ # 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, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operation_result_operations import build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +43,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, operation_id: str, @@ -64,36 +68,33 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + operation_id=operation_id, + location=location, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize('OperationJobExtendedInfo', pipeline_response) @@ -101,9 +102,12 @@ async def get( response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/locations/{location}/operationResults/{operationId}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/locations/{location}/operationResults/{operationId}"} # type: ignore + 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 new file mode 100644 index 000000000000..d2c6021b408c --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_status_backup_vault_context_operations.py @@ -0,0 +1,108 @@ +# 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, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._operation_status_backup_vault_context_operations import build_get_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class OperationStatusBackupVaultContextOperations: + """OperationStatusBackupVaultContextOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.dataprotection.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + vault_name: str, + operation_id: str, + **kwargs: Any + ) -> "_models.OperationResource": + """Gets the operation status for an operation over a BackupVault's context. + + Gets the operation status for an operation over a BackupVault's context. + + :param resource_group_name: The name of the resource group where the backup vault is present. + :type resource_group_name: str + :param vault_name: The name of the backup vault. + :type vault_name: str + :param operation_id: + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OperationResource, or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.OperationResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + operation_id=operation_id, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **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('OperationResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/operationStatus/{operationId}"} # type: ignore + diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_status_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_status_operations.py index cd20c682149d..838a39fe86bc 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_status_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_status_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,16 +6,18 @@ # 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, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operation_status_operations import build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +43,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, location: str, @@ -64,28 +68,25 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + location=location, + operation_id=operation_id, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -98,4 +99,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/locations/{location}/operationStatus/{operationId}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/locations/{location}/operationStatus/{operationId}"} # type: ignore + diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_status_resource_group_context_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_status_resource_group_context_operations.py new file mode 100644 index 000000000000..06fc01959f91 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_status_resource_group_context_operations.py @@ -0,0 +1,104 @@ +# 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, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._operation_status_resource_group_context_operations import build_get_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class OperationStatusResourceGroupContextOperations: + """OperationStatusResourceGroupContextOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.dataprotection.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + operation_id: str, + **kwargs: Any + ) -> "_models.OperationResource": + """Gets the operation status for an operation over a ResourceGroup's context. + + Gets the operation status for an operation over a ResourceGroup's context. + + :param resource_group_name: The name of the resource group where the backup vault is present. + :type resource_group_name: str + :param operation_id: + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OperationResource, or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.OperationResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + operation_id=operation_id, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **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('OperationResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/operationStatus/{operationId}"} # type: ignore + diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_recovery_points_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_recovery_points_operations.py index efb6fbeb9455..b2ba32b57e67 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_recovery_points_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_recovery_points_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,20 @@ # 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, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +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.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._recovery_points_operations import build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,10 +45,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - vault_name: str, resource_group_name: str, + vault_name: str, backup_instance_name: str, filter: Optional[str] = None, skip_token: Optional[str] = None, @@ -52,61 +57,65 @@ def list( ) -> AsyncIterable["_models.AzureBackupRecoveryPointResourceList"]: """Returns a list of Recovery Points for a DataSource in a vault. - :param vault_name: The name of the backup vault. - :type vault_name: str :param resource_group_name: The name of the resource group where the backup vault is present. :type resource_group_name: str + :param vault_name: The name of the backup vault. + :type vault_name: str :param backup_instance_name: The name of the backup instance. :type backup_instance_name: str - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str - :param skip_token: skipToken Filter. + :param skip_token: skipToken Filter. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AzureBackupRecoveryPointResourceList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.AzureBackupRecoveryPointResourceList] + :return: An iterator like instance of either AzureBackupRecoveryPointResourceList or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.AzureBackupRecoveryPointResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AzureBackupRecoveryPointResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'backupInstanceName': self._serialize.url("backup_instance_name", backup_instance_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + api_version=api_version, + filter=filter, + skip_token=skip_token, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + api_version=api_version, + filter=filter, + skip_token=skip_token, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AzureBackupRecoveryPointResourceList', pipeline_response) + deserialized = self._deserialize("AzureBackupRecoveryPointResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -115,7 +124,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -124,25 +137,27 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/recoveryPoints'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/recoveryPoints"} # type: ignore + @distributed_trace_async async def get( self, - vault_name: str, resource_group_name: str, + vault_name: str, backup_instance_name: str, recovery_point_id: str, **kwargs: Any ) -> "_models.AzureBackupRecoveryPointResource": """Gets a Recovery Point using recoveryPointId for a Datasource. - :param vault_name: The name of the backup vault. - :type vault_name: str :param resource_group_name: The name of the resource group where the backup vault is present. :type resource_group_name: str + :param vault_name: The name of the backup vault. + :type vault_name: str :param backup_instance_name: The name of the backup instance. :type backup_instance_name: str :param recovery_point_id: @@ -157,30 +172,27 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'backupInstanceName': self._serialize.url("backup_instance_name", backup_instance_name, 'str'), - 'recoveryPointId': self._serialize.url("recovery_point_id", recovery_point_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + recovery_point_id=recovery_point_id, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -193,4 +205,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/recoveryPoints/{recoveryPointId}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/recoveryPoints/{recoveryPointId}"} # type: ignore + diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_resource_guards_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_resource_guards_operations.py index 0f9b1f08b6b6..14494dc464d8 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_resource_guards_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_resource_guards_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,20 @@ # 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, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +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.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._resource_guards_operations import build_delete_request, build_get_backup_security_pin_requests_objects_request, build_get_default_backup_security_pin_requests_object_request, build_get_default_delete_protected_item_requests_object_request, build_get_default_delete_resource_guard_proxy_requests_object_request, build_get_default_disable_soft_delete_requests_object_request, build_get_default_update_protected_item_requests_object_request, build_get_default_update_protection_policy_requests_object_request, build_get_delete_protected_item_requests_objects_request, build_get_delete_resource_guard_proxy_requests_objects_request, build_get_disable_soft_delete_requests_objects_request, build_get_request, build_get_resources_in_resource_group_request, build_get_resources_in_subscription_request, build_get_update_protected_item_requests_objects_request, build_get_update_protection_policy_requests_objects_request, build_patch_request, build_put_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +45,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def get_resources_in_subscription( self, **kwargs: Any @@ -50,43 +55,44 @@ def get_resources_in_subscription( Returns ResourceGuards collection belonging to a subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceGuardResourceList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.ResourceGuardResourceList] + :return: An iterator like instance of either ResourceGuardResourceList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.ResourceGuardResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGuardResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.get_resources_in_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_resources_in_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_resources_in_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_resources_in_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + 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('ResourceGuardResourceList', pipeline_response) + deserialized = self._deserialize("ResourceGuardResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -95,7 +101,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -104,11 +114,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - get_resources_in_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/resourceGuards'} # type: ignore + get_resources_in_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/resourceGuards"} # type: ignore + @distributed_trace def get_resources_in_resource_group( self, resource_group_name: str, @@ -121,44 +133,46 @@ def get_resources_in_resource_group( :param resource_group_name: The name of the resource group where the backup vault is present. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceGuardResourceList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.ResourceGuardResourceList] + :return: An iterator like instance of either ResourceGuardResourceList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.ResourceGuardResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGuardResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.get_resources_in_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_resources_in_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=self.get_resources_in_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_resources_in_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=next_link, + ) + 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('ResourceGuardResourceList', pipeline_response) + deserialized = self._deserialize("ResourceGuardResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -167,7 +181,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -176,11 +194,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - get_resources_in_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards'} # type: ignore + get_resources_in_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards"} # type: ignore + @distributed_trace_async async def put( self, resource_group_name: str, @@ -208,33 +228,29 @@ async def put( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.put.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGuardsName': self._serialize.url("resource_guards_name", resource_guards_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ResourceGuardResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ResourceGuardResource') + + request = build_put_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + resource_guards_name=resource_guards_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.put.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -247,8 +263,11 @@ async def put( return cls(pipeline_response, deserialized, {}) return deserialized - put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}'} # type: ignore + put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}"} # type: ignore + + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -273,28 +292,25 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGuardsName': self._serialize.url("resource_guards_name", resource_guards_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-04-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + resource_guards_name=resource_guards_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -307,9 +323,12 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}'} # type: ignore - async def delete( + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}"} # type: ignore + + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_guards_name: str, @@ -333,28 +352,25 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGuardsName': self._serialize.url("resource_guards_name", resource_guards_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-04-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + resource_guards_name=resource_guards_name, + api_version=api_version, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -364,8 +380,10 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}"} # type: ignore + + @distributed_trace_async async def patch( self, resource_group_name: str, @@ -373,7 +391,8 @@ async def patch( parameters: "_models.PatchResourceRequestInput", **kwargs: Any ) -> "_models.ResourceGuardResource": - """Updates a ResourceGuard resource belonging to a resource group. For example, updating tags for a resource. + """Updates a ResourceGuard resource belonging to a resource group. For example, updating tags for + a resource. Updates a ResourceGuard resource belonging to a resource group. For example, updating tags for a resource. @@ -394,33 +413,29 @@ async def patch( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.patch.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGuardsName': self._serialize.url("resource_guards_name", resource_guards_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'PatchResourceRequestInput') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'PatchResourceRequestInput') + + request = build_patch_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + resource_guards_name=resource_guards_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.patch.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -433,15 +448,19 @@ async def patch( return cls(pipeline_response, deserialized, {}) return deserialized - patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}'} # type: ignore + patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}"} # type: ignore + + + @distributed_trace def get_disable_soft_delete_requests_objects( self, resource_group_name: str, resource_guards_name: str, **kwargs: Any ) -> AsyncIterable["_models.DppBaseResourceList"]: - """Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + """Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. @@ -452,44 +471,46 @@ def get_disable_soft_delete_requests_objects( :type resource_guards_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DppBaseResourceList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.DppBaseResourceList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.DppBaseResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DppBaseResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.get_disable_soft_delete_requests_objects.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGuardsName': self._serialize.url("resource_guards_name", resource_guards_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_disable_soft_delete_requests_objects_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + resource_guards_name=resource_guards_name, + api_version=api_version, + template_url=self.get_disable_soft_delete_requests_objects.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_disable_soft_delete_requests_objects_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + resource_guards_name=resource_guards_name, + api_version=api_version, + template_url=next_link, + ) + 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('DppBaseResourceList', pipeline_response) + deserialized = self._deserialize("DppBaseResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -498,7 +519,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -507,18 +532,21 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - get_disable_soft_delete_requests_objects.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/disableSoftDeleteRequests'} # type: ignore + get_disable_soft_delete_requests_objects.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/disableSoftDeleteRequests"} # type: ignore + @distributed_trace def get_delete_resource_guard_proxy_requests_objects( self, resource_group_name: str, resource_guards_name: str, **kwargs: Any ) -> AsyncIterable["_models.DppBaseResourceList"]: - """Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + """Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. @@ -529,44 +557,46 @@ def get_delete_resource_guard_proxy_requests_objects( :type resource_guards_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DppBaseResourceList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.DppBaseResourceList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.DppBaseResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DppBaseResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.get_delete_resource_guard_proxy_requests_objects.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGuardsName': self._serialize.url("resource_guards_name", resource_guards_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_delete_resource_guard_proxy_requests_objects_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + resource_guards_name=resource_guards_name, + api_version=api_version, + template_url=self.get_delete_resource_guard_proxy_requests_objects.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_delete_resource_guard_proxy_requests_objects_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + resource_guards_name=resource_guards_name, + api_version=api_version, + template_url=next_link, + ) + 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('DppBaseResourceList', pipeline_response) + deserialized = self._deserialize("DppBaseResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -575,7 +605,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -584,18 +618,21 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - get_delete_resource_guard_proxy_requests_objects.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/deleteResourceGuardProxyRequests'} # type: ignore + get_delete_resource_guard_proxy_requests_objects.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/deleteResourceGuardProxyRequests"} # type: ignore + @distributed_trace def get_backup_security_pin_requests_objects( self, resource_group_name: str, resource_guards_name: str, **kwargs: Any ) -> AsyncIterable["_models.DppBaseResourceList"]: - """Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + """Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. @@ -606,44 +643,46 @@ def get_backup_security_pin_requests_objects( :type resource_guards_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DppBaseResourceList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.DppBaseResourceList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.DppBaseResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DppBaseResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.get_backup_security_pin_requests_objects.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGuardsName': self._serialize.url("resource_guards_name", resource_guards_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_backup_security_pin_requests_objects_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + resource_guards_name=resource_guards_name, + api_version=api_version, + template_url=self.get_backup_security_pin_requests_objects.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_backup_security_pin_requests_objects_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + resource_guards_name=resource_guards_name, + api_version=api_version, + template_url=next_link, + ) + 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('DppBaseResourceList', pipeline_response) + deserialized = self._deserialize("DppBaseResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -652,7 +691,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -661,18 +704,21 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - get_backup_security_pin_requests_objects.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/getBackupSecurityPINRequests'} # type: ignore + get_backup_security_pin_requests_objects.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/getBackupSecurityPINRequests"} # type: ignore + @distributed_trace def get_delete_protected_item_requests_objects( self, resource_group_name: str, resource_guards_name: str, **kwargs: Any ) -> AsyncIterable["_models.DppBaseResourceList"]: - """Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + """Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. @@ -683,44 +729,46 @@ def get_delete_protected_item_requests_objects( :type resource_guards_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DppBaseResourceList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.DppBaseResourceList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.DppBaseResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DppBaseResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.get_delete_protected_item_requests_objects.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGuardsName': self._serialize.url("resource_guards_name", resource_guards_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_delete_protected_item_requests_objects_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + resource_guards_name=resource_guards_name, + api_version=api_version, + template_url=self.get_delete_protected_item_requests_objects.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_delete_protected_item_requests_objects_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + resource_guards_name=resource_guards_name, + api_version=api_version, + template_url=next_link, + ) + 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('DppBaseResourceList', pipeline_response) + deserialized = self._deserialize("DppBaseResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -729,7 +777,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -738,18 +790,21 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - get_delete_protected_item_requests_objects.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/deleteProtectedItemRequests'} # type: ignore + get_delete_protected_item_requests_objects.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/deleteProtectedItemRequests"} # type: ignore + @distributed_trace def get_update_protection_policy_requests_objects( self, resource_group_name: str, resource_guards_name: str, **kwargs: Any ) -> AsyncIterable["_models.DppBaseResourceList"]: - """Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + """Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. @@ -760,44 +815,46 @@ def get_update_protection_policy_requests_objects( :type resource_guards_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DppBaseResourceList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.DppBaseResourceList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.DppBaseResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DppBaseResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.get_update_protection_policy_requests_objects.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGuardsName': self._serialize.url("resource_guards_name", resource_guards_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_update_protection_policy_requests_objects_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + resource_guards_name=resource_guards_name, + api_version=api_version, + template_url=self.get_update_protection_policy_requests_objects.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_update_protection_policy_requests_objects_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + resource_guards_name=resource_guards_name, + api_version=api_version, + template_url=next_link, + ) + 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('DppBaseResourceList', pipeline_response) + deserialized = self._deserialize("DppBaseResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -806,7 +863,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -815,18 +876,21 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - get_update_protection_policy_requests_objects.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/updateProtectionPolicyRequests'} # type: ignore + get_update_protection_policy_requests_objects.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/updateProtectionPolicyRequests"} # type: ignore + @distributed_trace def get_update_protected_item_requests_objects( self, resource_group_name: str, resource_guards_name: str, **kwargs: Any ) -> AsyncIterable["_models.DppBaseResourceList"]: - """Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + """Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. @@ -837,44 +901,46 @@ def get_update_protected_item_requests_objects( :type resource_guards_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DppBaseResourceList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.DppBaseResourceList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.DppBaseResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DppBaseResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.get_update_protected_item_requests_objects.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGuardsName': self._serialize.url("resource_guards_name", resource_guards_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_update_protected_item_requests_objects_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + resource_guards_name=resource_guards_name, + api_version=api_version, + template_url=self.get_update_protected_item_requests_objects.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_update_protected_item_requests_objects_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + resource_guards_name=resource_guards_name, + api_version=api_version, + template_url=next_link, + ) + 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('DppBaseResourceList', pipeline_response) + deserialized = self._deserialize("DppBaseResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -883,7 +949,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -892,11 +962,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - get_update_protected_item_requests_objects.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/updateProtectedItemRequests'} # type: ignore + get_update_protected_item_requests_objects.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/updateProtectedItemRequests"} # type: ignore + @distributed_trace_async async def get_default_disable_soft_delete_requests_object( self, resource_group_name: str, @@ -904,7 +976,8 @@ async def get_default_disable_soft_delete_requests_object( request_name: str, **kwargs: Any ) -> "_models.DppBaseResource": - """Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + """Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. @@ -925,29 +998,26 @@ async def get_default_disable_soft_delete_requests_object( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get_default_disable_soft_delete_requests_object.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGuardsName': self._serialize.url("resource_guards_name", resource_guards_name, 'str'), - 'requestName': self._serialize.url("request_name", request_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-04-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_default_disable_soft_delete_requests_object_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + resource_guards_name=resource_guards_name, + request_name=request_name, + api_version=api_version, + template_url=self.get_default_disable_soft_delete_requests_object.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -960,8 +1030,11 @@ async def get_default_disable_soft_delete_requests_object( return cls(pipeline_response, deserialized, {}) return deserialized - get_default_disable_soft_delete_requests_object.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/disableSoftDeleteRequests/{requestName}'} # type: ignore + get_default_disable_soft_delete_requests_object.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/disableSoftDeleteRequests/{requestName}"} # type: ignore + + + @distributed_trace_async async def get_default_delete_resource_guard_proxy_requests_object( self, resource_group_name: str, @@ -969,7 +1042,8 @@ async def get_default_delete_resource_guard_proxy_requests_object( request_name: str, **kwargs: Any ) -> "_models.DppBaseResource": - """Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + """Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. @@ -990,29 +1064,26 @@ async def get_default_delete_resource_guard_proxy_requests_object( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get_default_delete_resource_guard_proxy_requests_object.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGuardsName': self._serialize.url("resource_guards_name", resource_guards_name, 'str'), - 'requestName': self._serialize.url("request_name", request_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-04-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_default_delete_resource_guard_proxy_requests_object_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + resource_guards_name=resource_guards_name, + request_name=request_name, + api_version=api_version, + template_url=self.get_default_delete_resource_guard_proxy_requests_object.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1025,8 +1096,11 @@ async def get_default_delete_resource_guard_proxy_requests_object( return cls(pipeline_response, deserialized, {}) return deserialized - get_default_delete_resource_guard_proxy_requests_object.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/deleteResourceGuardProxyRequests/{requestName}'} # type: ignore + get_default_delete_resource_guard_proxy_requests_object.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/deleteResourceGuardProxyRequests/{requestName}"} # type: ignore + + + @distributed_trace_async async def get_default_backup_security_pin_requests_object( self, resource_group_name: str, @@ -1034,7 +1108,8 @@ async def get_default_backup_security_pin_requests_object( request_name: str, **kwargs: Any ) -> "_models.DppBaseResource": - """Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + """Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. @@ -1055,29 +1130,26 @@ async def get_default_backup_security_pin_requests_object( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get_default_backup_security_pin_requests_object.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGuardsName': self._serialize.url("resource_guards_name", resource_guards_name, 'str'), - 'requestName': self._serialize.url("request_name", request_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-04-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_default_backup_security_pin_requests_object_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + resource_guards_name=resource_guards_name, + request_name=request_name, + api_version=api_version, + template_url=self.get_default_backup_security_pin_requests_object.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1090,8 +1162,11 @@ async def get_default_backup_security_pin_requests_object( return cls(pipeline_response, deserialized, {}) return deserialized - get_default_backup_security_pin_requests_object.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/getBackupSecurityPINRequests/{requestName}'} # type: ignore + get_default_backup_security_pin_requests_object.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/getBackupSecurityPINRequests/{requestName}"} # type: ignore + + + @distributed_trace_async async def get_default_delete_protected_item_requests_object( self, resource_group_name: str, @@ -1099,7 +1174,8 @@ async def get_default_delete_protected_item_requests_object( request_name: str, **kwargs: Any ) -> "_models.DppBaseResource": - """Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + """Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. @@ -1120,29 +1196,26 @@ async def get_default_delete_protected_item_requests_object( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get_default_delete_protected_item_requests_object.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGuardsName': self._serialize.url("resource_guards_name", resource_guards_name, 'str'), - 'requestName': self._serialize.url("request_name", request_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-04-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_default_delete_protected_item_requests_object_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + resource_guards_name=resource_guards_name, + request_name=request_name, + api_version=api_version, + template_url=self.get_default_delete_protected_item_requests_object.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1155,8 +1228,11 @@ async def get_default_delete_protected_item_requests_object( return cls(pipeline_response, deserialized, {}) return deserialized - get_default_delete_protected_item_requests_object.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/deleteProtectedItemRequests/{requestName}'} # type: ignore + get_default_delete_protected_item_requests_object.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/deleteProtectedItemRequests/{requestName}"} # type: ignore + + + @distributed_trace_async async def get_default_update_protection_policy_requests_object( self, resource_group_name: str, @@ -1164,7 +1240,8 @@ async def get_default_update_protection_policy_requests_object( request_name: str, **kwargs: Any ) -> "_models.DppBaseResource": - """Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + """Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. @@ -1185,29 +1262,26 @@ async def get_default_update_protection_policy_requests_object( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get_default_update_protection_policy_requests_object.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGuardsName': self._serialize.url("resource_guards_name", resource_guards_name, 'str'), - 'requestName': self._serialize.url("request_name", request_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-04-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_default_update_protection_policy_requests_object_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + resource_guards_name=resource_guards_name, + request_name=request_name, + api_version=api_version, + template_url=self.get_default_update_protection_policy_requests_object.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1220,8 +1294,11 @@ async def get_default_update_protection_policy_requests_object( return cls(pipeline_response, deserialized, {}) return deserialized - get_default_update_protection_policy_requests_object.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/updateProtectionPolicyRequests/{requestName}'} # type: ignore + get_default_update_protection_policy_requests_object.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/updateProtectionPolicyRequests/{requestName}"} # type: ignore + + + @distributed_trace_async async def get_default_update_protected_item_requests_object( self, resource_group_name: str, @@ -1229,7 +1306,8 @@ async def get_default_update_protected_item_requests_object( request_name: str, **kwargs: Any ) -> "_models.DppBaseResource": - """Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + """Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. @@ -1250,29 +1328,26 @@ async def get_default_update_protected_item_requests_object( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get_default_update_protected_item_requests_object.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGuardsName': self._serialize.url("resource_guards_name", resource_guards_name, 'str'), - 'requestName': self._serialize.url("request_name", request_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-04-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_default_update_protected_item_requests_object_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + resource_guards_name=resource_guards_name, + request_name=request_name, + api_version=api_version, + template_url=self.get_default_update_protected_item_requests_object.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1285,4 +1360,6 @@ async def get_default_update_protected_item_requests_object( return cls(pipeline_response, deserialized, {}) return deserialized - get_default_update_protected_item_requests_object.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/updateProtectedItemRequests/{requestName}'} # type: ignore + + get_default_update_protected_item_requests_object.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/updateProtectedItemRequests/{requestName}"} # type: ignore + diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_restorable_time_ranges_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_restorable_time_ranges_operations.py index 73ec6d0bed24..5621c980a23a 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_restorable_time_ranges_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_restorable_time_ranges_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,16 +6,18 @@ # 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, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._restorable_time_ranges_operations import build_find_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,20 +43,21 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def find( self, - vault_name: str, resource_group_name: str, + vault_name: str, backup_instance_name: str, parameters: "_models.AzureBackupFindRestorableTimeRangesRequest", **kwargs: Any ) -> "_models.AzureBackupFindRestorableTimeRangesResponseResource": """find. - :param vault_name: The name of the backup vault. - :type vault_name: str :param resource_group_name: The name of the resource group where the backup vault is present. :type resource_group_name: str + :param vault_name: The name of the backup vault. + :type vault_name: str :param backup_instance_name: The name of the backup instance. :type backup_instance_name: str :param parameters: Request body for operation. @@ -68,34 +72,30 @@ async def find( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.find.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'backupInstanceName': self._serialize.url("backup_instance_name", backup_instance_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'AzureBackupFindRestorableTimeRangesRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'AzureBackupFindRestorableTimeRangesRequest') + + request = build_find_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.find.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -108,4 +108,6 @@ async def find( return cls(pipeline_response, deserialized, {}) return deserialized - find.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/findRestorableTimeRanges'} # type: ignore + + find.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/findRestorableTimeRanges"} # type: ignore + diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/__init__.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/__init__.py index 1d823e9b0535..1aa73f4d8513 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 @@ -6,241 +6,132 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AbsoluteDeleteOption - from ._models_py3 import AdHocBackupRuleOptions - from ._models_py3 import AdhocBackupTriggerOption - from ._models_py3 import AdhocBasedTaggingCriteria - from ._models_py3 import AdhocBasedTriggerContext - from ._models_py3 import AuthCredentials - from ._models_py3 import AzureBackupDiscreteRecoveryPoint - from ._models_py3 import AzureBackupFindRestorableTimeRangesRequest - from ._models_py3 import AzureBackupFindRestorableTimeRangesRequestResource - from ._models_py3 import AzureBackupFindRestorableTimeRangesResponse - from ._models_py3 import AzureBackupFindRestorableTimeRangesResponseResource - from ._models_py3 import AzureBackupJob - from ._models_py3 import AzureBackupJobResource - from ._models_py3 import AzureBackupJobResourceList - from ._models_py3 import AzureBackupParams - from ._models_py3 import AzureBackupRecoveryPoint - from ._models_py3 import AzureBackupRecoveryPointBasedRestoreRequest - from ._models_py3 import AzureBackupRecoveryPointResource - from ._models_py3 import AzureBackupRecoveryPointResourceList - from ._models_py3 import AzureBackupRecoveryTimeBasedRestoreRequest - from ._models_py3 import AzureBackupRehydrationRequest - from ._models_py3 import AzureBackupRestoreRequest - from ._models_py3 import AzureBackupRestoreWithRehydrationRequest - from ._models_py3 import AzureBackupRule - from ._models_py3 import AzureOperationalStoreParameters - from ._models_py3 import AzureRetentionRule - from ._models_py3 import BackupCriteria - from ._models_py3 import BackupInstance - from ._models_py3 import BackupInstanceResource - from ._models_py3 import BackupInstanceResourceList - from ._models_py3 import BackupParameters - from ._models_py3 import BackupPolicy - from ._models_py3 import BackupSchedule - from ._models_py3 import BackupVault - from ._models_py3 import BackupVaultResource - from ._models_py3 import BackupVaultResourceList - from ._models_py3 import BaseBackupPolicy - from ._models_py3 import BaseBackupPolicyResource - from ._models_py3 import BaseBackupPolicyResourceList - from ._models_py3 import BasePolicyRule - from ._models_py3 import CheckNameAvailabilityRequest - from ._models_py3 import CheckNameAvailabilityResult - from ._models_py3 import ClientDiscoveryDisplay - from ._models_py3 import ClientDiscoveryForLogSpecification - from ._models_py3 import ClientDiscoveryForProperties - from ._models_py3 import ClientDiscoveryForServiceSpecification - from ._models_py3 import ClientDiscoveryResponse - from ._models_py3 import ClientDiscoveryValueForSingleApi - from ._models_py3 import CopyOnExpiryOption - from ._models_py3 import CopyOption - from ._models_py3 import CustomCopyOption - from ._models_py3 import DataStoreInfoBase - from ._models_py3 import DataStoreParameters - from ._models_py3 import Datasource - from ._models_py3 import DatasourceSet - from ._models_py3 import Day - from ._models_py3 import DeleteOption - from ._models_py3 import DppBaseResource - from ._models_py3 import DppBaseResourceList - from ._models_py3 import DppIdentityDetails - from ._models_py3 import DppResource - from ._models_py3 import DppResourceList - from ._models_py3 import DppTrackedResource - from ._models_py3 import DppTrackedResourceList - from ._models_py3 import DppWorkerRequest - from ._models_py3 import Error - from ._models_py3 import ErrorAdditionalInfo - from ._models_py3 import ExportJobsResult - from ._models_py3 import FeatureValidationRequest - from ._models_py3 import FeatureValidationRequestBase - from ._models_py3 import FeatureValidationResponse - from ._models_py3 import FeatureValidationResponseBase - from ._models_py3 import ImmediateCopyOption - from ._models_py3 import InnerError - from ._models_py3 import ItemLevelRestoreCriteria - from ._models_py3 import ItemLevelRestoreTargetInfo - from ._models_py3 import JobExtendedInfo - from ._models_py3 import JobSubTask - from ._models_py3 import OperationExtendedInfo - from ._models_py3 import OperationJobExtendedInfo - from ._models_py3 import OperationResource - from ._models_py3 import PatchResourceRequestInput - from ._models_py3 import PolicyInfo - from ._models_py3 import PolicyParameters - from ._models_py3 import ProtectionStatusDetails - from ._models_py3 import RangeBasedItemLevelRestoreCriteria - from ._models_py3 import RecoveryPointDataStoreDetails - from ._models_py3 import RecoveryPointsFilters - from ._models_py3 import ResourceGuard - from ._models_py3 import ResourceGuardOperation - from ._models_py3 import ResourceGuardResource - from ._models_py3 import ResourceGuardResourceList - from ._models_py3 import ResourceMoveDetails - from ._models_py3 import RestorableTimeRange - from ._models_py3 import RestoreFilesTargetInfo - from ._models_py3 import RestoreJobRecoveryPointDetails - from ._models_py3 import RestoreTargetInfo - from ._models_py3 import RestoreTargetInfoBase - from ._models_py3 import RetentionTag - from ._models_py3 import ScheduleBasedBackupCriteria - from ._models_py3 import ScheduleBasedTriggerContext - from ._models_py3 import SecretStoreBasedAuthCredentials - from ._models_py3 import SecretStoreResource - from ._models_py3 import SourceLifeCycle - from ._models_py3 import StorageSetting - from ._models_py3 import SupportedFeature - from ._models_py3 import SystemData - from ._models_py3 import TaggingCriteria - from ._models_py3 import TargetCopySetting - from ._models_py3 import TargetDetails - from ._models_py3 import TriggerBackupRequest - from ._models_py3 import TriggerContext - from ._models_py3 import UserFacingError - from ._models_py3 import ValidateForBackupRequest - from ._models_py3 import ValidateRestoreRequestObject -except (SyntaxError, ImportError): - from ._models import AbsoluteDeleteOption # type: ignore - from ._models import AdHocBackupRuleOptions # type: ignore - from ._models import AdhocBackupTriggerOption # type: ignore - from ._models import AdhocBasedTaggingCriteria # type: ignore - from ._models import AdhocBasedTriggerContext # type: ignore - from ._models import AuthCredentials # type: ignore - from ._models import AzureBackupDiscreteRecoveryPoint # type: ignore - from ._models import AzureBackupFindRestorableTimeRangesRequest # type: ignore - from ._models import AzureBackupFindRestorableTimeRangesRequestResource # type: ignore - from ._models import AzureBackupFindRestorableTimeRangesResponse # type: ignore - from ._models import AzureBackupFindRestorableTimeRangesResponseResource # type: ignore - from ._models import AzureBackupJob # type: ignore - from ._models import AzureBackupJobResource # type: ignore - from ._models import AzureBackupJobResourceList # type: ignore - from ._models import AzureBackupParams # type: ignore - from ._models import AzureBackupRecoveryPoint # type: ignore - from ._models import AzureBackupRecoveryPointBasedRestoreRequest # type: ignore - from ._models import AzureBackupRecoveryPointResource # type: ignore - from ._models import AzureBackupRecoveryPointResourceList # type: ignore - from ._models import AzureBackupRecoveryTimeBasedRestoreRequest # type: ignore - from ._models import AzureBackupRehydrationRequest # type: ignore - from ._models import AzureBackupRestoreRequest # type: ignore - from ._models import AzureBackupRestoreWithRehydrationRequest # type: ignore - from ._models import AzureBackupRule # type: ignore - from ._models import AzureOperationalStoreParameters # type: ignore - from ._models import AzureRetentionRule # type: ignore - from ._models import BackupCriteria # type: ignore - from ._models import BackupInstance # type: ignore - from ._models import BackupInstanceResource # type: ignore - from ._models import BackupInstanceResourceList # type: ignore - from ._models import BackupParameters # type: ignore - from ._models import BackupPolicy # type: ignore - from ._models import BackupSchedule # type: ignore - from ._models import BackupVault # type: ignore - from ._models import BackupVaultResource # type: ignore - from ._models import BackupVaultResourceList # type: ignore - from ._models import BaseBackupPolicy # type: ignore - from ._models import BaseBackupPolicyResource # type: ignore - from ._models import BaseBackupPolicyResourceList # type: ignore - from ._models import BasePolicyRule # type: ignore - from ._models import CheckNameAvailabilityRequest # type: ignore - from ._models import CheckNameAvailabilityResult # type: ignore - from ._models import ClientDiscoveryDisplay # type: ignore - from ._models import ClientDiscoveryForLogSpecification # type: ignore - from ._models import ClientDiscoveryForProperties # type: ignore - from ._models import ClientDiscoveryForServiceSpecification # type: ignore - from ._models import ClientDiscoveryResponse # type: ignore - from ._models import ClientDiscoveryValueForSingleApi # type: ignore - from ._models import CopyOnExpiryOption # type: ignore - from ._models import CopyOption # type: ignore - from ._models import CustomCopyOption # type: ignore - from ._models import DataStoreInfoBase # type: ignore - from ._models import DataStoreParameters # type: ignore - from ._models import Datasource # type: ignore - from ._models import DatasourceSet # type: ignore - from ._models import Day # type: ignore - from ._models import DeleteOption # type: ignore - from ._models import DppBaseResource # type: ignore - from ._models import DppBaseResourceList # type: ignore - from ._models import DppIdentityDetails # type: ignore - from ._models import DppResource # type: ignore - from ._models import DppResourceList # type: ignore - from ._models import DppTrackedResource # type: ignore - from ._models import DppTrackedResourceList # type: ignore - from ._models import DppWorkerRequest # type: ignore - from ._models import Error # type: ignore - from ._models import ErrorAdditionalInfo # type: ignore - from ._models import ExportJobsResult # type: ignore - from ._models import FeatureValidationRequest # type: ignore - from ._models import FeatureValidationRequestBase # type: ignore - from ._models import FeatureValidationResponse # type: ignore - from ._models import FeatureValidationResponseBase # type: ignore - from ._models import ImmediateCopyOption # type: ignore - from ._models import InnerError # type: ignore - from ._models import ItemLevelRestoreCriteria # type: ignore - from ._models import ItemLevelRestoreTargetInfo # type: ignore - from ._models import JobExtendedInfo # type: ignore - from ._models import JobSubTask # type: ignore - from ._models import OperationExtendedInfo # type: ignore - from ._models import OperationJobExtendedInfo # type: ignore - from ._models import OperationResource # type: ignore - from ._models import PatchResourceRequestInput # type: ignore - from ._models import PolicyInfo # type: ignore - from ._models import PolicyParameters # type: ignore - from ._models import ProtectionStatusDetails # type: ignore - from ._models import RangeBasedItemLevelRestoreCriteria # type: ignore - from ._models import RecoveryPointDataStoreDetails # type: ignore - from ._models import RecoveryPointsFilters # type: ignore - from ._models import ResourceGuard # type: ignore - from ._models import ResourceGuardOperation # type: ignore - from ._models import ResourceGuardResource # type: ignore - from ._models import ResourceGuardResourceList # type: ignore - from ._models import ResourceMoveDetails # type: ignore - from ._models import RestorableTimeRange # type: ignore - from ._models import RestoreFilesTargetInfo # type: ignore - from ._models import RestoreJobRecoveryPointDetails # type: ignore - from ._models import RestoreTargetInfo # type: ignore - from ._models import RestoreTargetInfoBase # type: ignore - from ._models import RetentionTag # type: ignore - from ._models import ScheduleBasedBackupCriteria # type: ignore - from ._models import ScheduleBasedTriggerContext # type: ignore - from ._models import SecretStoreBasedAuthCredentials # type: ignore - from ._models import SecretStoreResource # type: ignore - from ._models import SourceLifeCycle # type: ignore - from ._models import StorageSetting # type: ignore - from ._models import SupportedFeature # type: ignore - from ._models import SystemData # type: ignore - from ._models import TaggingCriteria # type: ignore - from ._models import TargetCopySetting # type: ignore - from ._models import TargetDetails # type: ignore - from ._models import TriggerBackupRequest # type: ignore - from ._models import TriggerContext # type: ignore - from ._models import UserFacingError # type: ignore - from ._models import ValidateForBackupRequest # type: ignore - from ._models import ValidateRestoreRequestObject # type: ignore +from ._models_py3 import AbsoluteDeleteOption +from ._models_py3 import AdHocBackupRuleOptions +from ._models_py3 import AdhocBackupTriggerOption +from ._models_py3 import AdhocBasedTaggingCriteria +from ._models_py3 import AdhocBasedTriggerContext +from ._models_py3 import AuthCredentials +from ._models_py3 import AzureBackupDiscreteRecoveryPoint +from ._models_py3 import AzureBackupFindRestorableTimeRangesRequest +from ._models_py3 import AzureBackupFindRestorableTimeRangesRequestResource +from ._models_py3 import AzureBackupFindRestorableTimeRangesResponse +from ._models_py3 import AzureBackupFindRestorableTimeRangesResponseResource +from ._models_py3 import AzureBackupJob +from ._models_py3 import AzureBackupJobResource +from ._models_py3 import AzureBackupJobResourceList +from ._models_py3 import AzureBackupParams +from ._models_py3 import AzureBackupRecoveryPoint +from ._models_py3 import AzureBackupRecoveryPointBasedRestoreRequest +from ._models_py3 import AzureBackupRecoveryPointResource +from ._models_py3 import AzureBackupRecoveryPointResourceList +from ._models_py3 import AzureBackupRecoveryTimeBasedRestoreRequest +from ._models_py3 import AzureBackupRehydrationRequest +from ._models_py3 import AzureBackupRestoreRequest +from ._models_py3 import AzureBackupRestoreWithRehydrationRequest +from ._models_py3 import AzureBackupRule +from ._models_py3 import AzureMonitorAlertSettings +from ._models_py3 import AzureOperationalStoreParameters +from ._models_py3 import AzureRetentionRule +from ._models_py3 import BackupCriteria +from ._models_py3 import BackupInstance +from ._models_py3 import BackupInstanceResource +from ._models_py3 import BackupInstanceResourceList +from ._models_py3 import BackupParameters +from ._models_py3 import BackupPolicy +from ._models_py3 import BackupSchedule +from ._models_py3 import BackupVault +from ._models_py3 import BackupVaultResource +from ._models_py3 import BackupVaultResourceList +from ._models_py3 import BaseBackupPolicy +from ._models_py3 import BaseBackupPolicyResource +from ._models_py3 import BaseBackupPolicyResourceList +from ._models_py3 import BasePolicyRule +from ._models_py3 import CheckNameAvailabilityRequest +from ._models_py3 import CheckNameAvailabilityResult +from ._models_py3 import ClientDiscoveryDisplay +from ._models_py3 import ClientDiscoveryForLogSpecification +from ._models_py3 import ClientDiscoveryForProperties +from ._models_py3 import ClientDiscoveryForServiceSpecification +from ._models_py3 import ClientDiscoveryResponse +from ._models_py3 import ClientDiscoveryValueForSingleApi +from ._models_py3 import CopyOnExpiryOption +from ._models_py3 import CopyOption +from ._models_py3 import CustomCopyOption +from ._models_py3 import DataStoreInfoBase +from ._models_py3 import DataStoreParameters +from ._models_py3 import Datasource +from ._models_py3 import DatasourceSet +from ._models_py3 import Day +from ._models_py3 import DeleteOption +from ._models_py3 import DppBaseResource +from ._models_py3 import DppBaseResourceList +from ._models_py3 import DppIdentityDetails +from ._models_py3 import DppResource +from ._models_py3 import DppResourceList +from ._models_py3 import DppTrackedResource +from ._models_py3 import DppTrackedResourceList +from ._models_py3 import DppWorkerRequest +from ._models_py3 import Error +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import ExportJobsResult +from ._models_py3 import FeatureValidationRequest +from ._models_py3 import FeatureValidationRequestBase +from ._models_py3 import FeatureValidationResponse +from ._models_py3 import FeatureValidationResponseBase +from ._models_py3 import ImmediateCopyOption +from ._models_py3 import InnerError +from ._models_py3 import ItemLevelRestoreCriteria +from ._models_py3 import ItemLevelRestoreTargetInfo +from ._models_py3 import JobExtendedInfo +from ._models_py3 import JobSubTask +from ._models_py3 import KubernetesPVRestoreCriteria +from ._models_py3 import KubernetesStorageClassRestoreCriteria +from ._models_py3 import MonitoringSettings +from ._models_py3 import OperationExtendedInfo +from ._models_py3 import OperationJobExtendedInfo +from ._models_py3 import OperationResource +from ._models_py3 import PatchBackupVaultInput +from ._models_py3 import PatchResourceRequestInput +from ._models_py3 import PolicyInfo +from ._models_py3 import PolicyParameters +from ._models_py3 import ProtectionStatusDetails +from ._models_py3 import RangeBasedItemLevelRestoreCriteria +from ._models_py3 import RecoveryPointDataStoreDetails +from ._models_py3 import RecoveryPointsFilters +from ._models_py3 import ResourceGuard +from ._models_py3 import ResourceGuardOperation +from ._models_py3 import ResourceGuardResource +from ._models_py3 import ResourceGuardResourceList +from ._models_py3 import ResourceMoveDetails +from ._models_py3 import RestorableTimeRange +from ._models_py3 import RestoreFilesTargetInfo +from ._models_py3 import RestoreJobRecoveryPointDetails +from ._models_py3 import RestoreTargetInfo +from ._models_py3 import RestoreTargetInfoBase +from ._models_py3 import RetentionTag +from ._models_py3 import ScheduleBasedBackupCriteria +from ._models_py3 import ScheduleBasedTriggerContext +from ._models_py3 import SecretStoreBasedAuthCredentials +from ._models_py3 import SecretStoreResource +from ._models_py3 import SourceLifeCycle +from ._models_py3 import StorageSetting +from ._models_py3 import SupportedFeature +from ._models_py3 import SyncBackupInstanceRequest +from ._models_py3 import SystemData +from ._models_py3 import TaggingCriteria +from ._models_py3 import TargetCopySetting +from ._models_py3 import TargetDetails +from ._models_py3 import TriggerBackupRequest +from ._models_py3 import TriggerContext +from ._models_py3 import UserFacingError +from ._models_py3 import ValidateForBackupRequest +from ._models_py3 import ValidateRestoreRequestObject + from ._data_protection_client_enums import ( AbsoluteMarker, + AlertsState, CreatedByType, CurrentProtectionState, DataStoreTypes, @@ -260,6 +151,8 @@ Status, StorageSettingStoreTypes, StorageSettingTypes, + SyncType, + ValidationType, WeekNumber, ) @@ -288,6 +181,7 @@ 'AzureBackupRestoreRequest', 'AzureBackupRestoreWithRehydrationRequest', 'AzureBackupRule', + 'AzureMonitorAlertSettings', 'AzureOperationalStoreParameters', 'AzureRetentionRule', 'BackupCriteria', @@ -342,9 +236,13 @@ 'ItemLevelRestoreTargetInfo', 'JobExtendedInfo', 'JobSubTask', + 'KubernetesPVRestoreCriteria', + 'KubernetesStorageClassRestoreCriteria', + 'MonitoringSettings', 'OperationExtendedInfo', 'OperationJobExtendedInfo', 'OperationResource', + 'PatchBackupVaultInput', 'PatchResourceRequestInput', 'PolicyInfo', 'PolicyParameters', @@ -370,6 +268,7 @@ 'SourceLifeCycle', 'StorageSetting', 'SupportedFeature', + 'SyncBackupInstanceRequest', 'SystemData', 'TaggingCriteria', 'TargetCopySetting', @@ -380,6 +279,7 @@ 'ValidateForBackupRequest', 'ValidateRestoreRequestObject', 'AbsoluteMarker', + 'AlertsState', 'CreatedByType', 'CurrentProtectionState', 'DataStoreTypes', @@ -399,5 +299,7 @@ 'Status', 'StorageSettingStoreTypes', 'StorageSettingTypes', + 'SyncType', + 'ValidationType', 'WeekNumber', ] diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/_data_protection_client_enums.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/_data_protection_client_enums.py index 926803c67b2c..1e451c3df475 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/_data_protection_client_enums.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/_data_protection_client_enums.py @@ -6,27 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AbsoluteMarker(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AbsoluteMarker(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ALL_BACKUP = "AllBackup" FIRST_OF_DAY = "FirstOfDay" @@ -34,7 +19,12 @@ class AbsoluteMarker(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FIRST_OF_WEEK = "FirstOfWeek" FIRST_OF_YEAR = "FirstOfYear" -class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AlertsState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + + ENABLED = "Enabled" + DISABLED = "Disabled" + +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that created the resource. """ @@ -43,7 +33,7 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class CurrentProtectionState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CurrentProtectionState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the current protection state of the resource """ @@ -60,7 +50,7 @@ class CurrentProtectionState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum) SOFT_DELETED = "SoftDeleted" UPDATING_PROTECTION = "UpdatingProtection" -class DataStoreTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DataStoreTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """type of datastore; Operational/Vault/Archive """ @@ -68,7 +58,7 @@ class DataStoreTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): VAULT_STORE = "VaultStore" ARCHIVE_STORE = "ArchiveStore" -class DayOfWeek(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DayOfWeek(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): FRIDAY = "Friday" MONDAY = "Monday" @@ -78,7 +68,7 @@ class DayOfWeek(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): TUESDAY = "Tuesday" WEDNESDAY = "Wednesday" -class FeatureSupportStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class FeatureSupportStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """feature support status """ @@ -89,14 +79,14 @@ class FeatureSupportStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): PUBLIC_PREVIEW = "PublicPreview" GENERALLY_AVAILABLE = "GenerallyAvailable" -class FeatureType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class FeatureType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """backup support feature type. """ INVALID = "Invalid" DATA_SOURCE_TYPE = "DataSourceType" -class Month(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Month(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): APRIL = "April" AUGUST = "August" @@ -111,7 +101,7 @@ class Month(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): OCTOBER = "October" SEPTEMBER = "September" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the BackupVault resource """ @@ -121,13 +111,13 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): UNKNOWN = "Unknown" UPDATING = "Updating" -class RecoveryOption(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RecoveryOption(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Recovery Option """ FAIL_IF_EXISTS = "FailIfExists" -class RehydrationPriority(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RehydrationPriority(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Priority to be used for rehydration. Values High or Standard """ @@ -135,7 +125,7 @@ class RehydrationPriority(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): HIGH = "High" STANDARD = "Standard" -class RehydrationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RehydrationStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): CREATE_IN_PROGRESS = "CREATE_IN_PROGRESS" COMPLETED = "COMPLETED" @@ -143,7 +133,7 @@ class RehydrationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): DELETED = "DELETED" FAILED = "FAILED" -class ResourceMoveState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ResourceMoveState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Resource move state for backup vault """ @@ -158,7 +148,7 @@ class ResourceMoveState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): PARTIAL_SUCCESS = "PartialSuccess" MOVE_SUCCEEDED = "MoveSucceeded" -class RestoreSourceDataStoreType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RestoreSourceDataStoreType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets or sets the type of the source data store. """ @@ -166,7 +156,7 @@ class RestoreSourceDataStoreType(with_metaclass(_CaseInsensitiveEnumMeta, str, E VAULT_STORE = "VaultStore" ARCHIVE_STORE = "ArchiveStore" -class RestoreTargetLocationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RestoreTargetLocationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Denotes the target location where the data will be restored, string value for the enum {Microsoft.Internal.AzureBackup.DataProtection.Common.Interface.RestoreTargetLocationType} @@ -176,14 +166,14 @@ class RestoreTargetLocationType(with_metaclass(_CaseInsensitiveEnumMeta, str, En AZURE_BLOBS = "AzureBlobs" AZURE_FILES = "AzureFiles" -class SecretStoreType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SecretStoreType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets or sets the type of secret store """ INVALID = "Invalid" AZURE_KEY_VAULT = "AzureKeyVault" -class SourceDataStoreType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SourceDataStoreType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets or sets the type of the source data store. """ @@ -191,7 +181,7 @@ class SourceDataStoreType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SNAPSHOT_STORE = "SnapshotStore" VAULT_STORE = "VaultStore" -class Status(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Status(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the protection status of the resource """ @@ -202,7 +192,7 @@ class Status(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SOFT_DELETED = "SoftDeleted" SOFT_DELETING = "SoftDeleting" -class StorageSettingStoreTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StorageSettingStoreTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets or sets the type of the datastore. """ @@ -210,14 +200,29 @@ class StorageSettingStoreTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu SNAPSHOT_STORE = "SnapshotStore" VAULT_STORE = "VaultStore" -class StorageSettingTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StorageSettingTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets or sets the type. """ GEO_REDUNDANT = "GeoRedundant" LOCALLY_REDUNDANT = "LocallyRedundant" -class WeekNumber(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SyncType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Field indicating sync type e.g. to sync only in case of failure or in all cases + """ + + DEFAULT = "Default" + FORCE_RESYNC = "ForceResync" + +class ValidationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the type of validation. In case of DeepValidation, all validations from + /validateForBackup API will run again. + """ + + SHALLOW_VALIDATION = "ShallowValidation" + DEEP_VALIDATION = "DeepValidation" + +class WeekNumber(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): FIRST = "First" FOURTH = "Fourth" diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/_models.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/_models.py deleted file mode 100644 index 459c310a482e..000000000000 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/_models.py +++ /dev/null @@ -1,4205 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import msrest.serialization - - -class DeleteOption(msrest.serialization.Model): - """Delete Option. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AbsoluteDeleteOption. - - All required parameters must be populated in order to send to Azure. - - :param duration: Required. Duration of deletion after given timespan. - :type duration: str - :param object_type: Required. Type of the specific object - used for deserializing.Constant - filled by server. - :type object_type: str - """ - - _validation = { - 'duration': {'required': True}, - 'object_type': {'required': True}, - } - - _attribute_map = { - 'duration': {'key': 'duration', 'type': 'str'}, - 'object_type': {'key': 'objectType', 'type': 'str'}, - } - - _subtype_map = { - 'object_type': {'AbsoluteDeleteOption': 'AbsoluteDeleteOption'} - } - - def __init__( - self, - **kwargs - ): - super(DeleteOption, self).__init__(**kwargs) - self.duration = kwargs['duration'] - self.object_type = None # type: Optional[str] - - -class AbsoluteDeleteOption(DeleteOption): - """Delete option with duration. - - All required parameters must be populated in order to send to Azure. - - :param duration: Required. Duration of deletion after given timespan. - :type duration: str - :param object_type: Required. Type of the specific object - used for deserializing.Constant - filled by server. - :type object_type: str - """ - - _validation = { - 'duration': {'required': True}, - 'object_type': {'required': True}, - } - - _attribute_map = { - 'duration': {'key': 'duration', 'type': 'str'}, - 'object_type': {'key': 'objectType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AbsoluteDeleteOption, self).__init__(**kwargs) - self.object_type = 'AbsoluteDeleteOption' # type: str - - -class AdHocBackupRuleOptions(msrest.serialization.Model): - """Adhoc backup rules. - - All required parameters must be populated in order to send to Azure. - - :param rule_name: Required. - :type rule_name: str - :param trigger_option: Required. Adhoc backup trigger option. - :type trigger_option: ~azure.mgmt.dataprotection.models.AdhocBackupTriggerOption - """ - - _validation = { - 'rule_name': {'required': True}, - 'trigger_option': {'required': True}, - } - - _attribute_map = { - 'rule_name': {'key': 'ruleName', 'type': 'str'}, - 'trigger_option': {'key': 'triggerOption', 'type': 'AdhocBackupTriggerOption'}, - } - - def __init__( - self, - **kwargs - ): - super(AdHocBackupRuleOptions, self).__init__(**kwargs) - self.rule_name = kwargs['rule_name'] - self.trigger_option = kwargs['trigger_option'] - - -class AdhocBackupTriggerOption(msrest.serialization.Model): - """Adhoc backup trigger option. - - :param retention_tag_override: - :type retention_tag_override: str - """ - - _attribute_map = { - 'retention_tag_override': {'key': 'retentionTagOverride', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AdhocBackupTriggerOption, self).__init__(**kwargs) - self.retention_tag_override = kwargs.get('retention_tag_override', None) - - -class AdhocBasedTaggingCriteria(msrest.serialization.Model): - """Adhoc backup tagging criteria. - - :param tag_info: Retention tag information. - :type tag_info: ~azure.mgmt.dataprotection.models.RetentionTag - """ - - _attribute_map = { - 'tag_info': {'key': 'tagInfo', 'type': 'RetentionTag'}, - } - - def __init__( - self, - **kwargs - ): - super(AdhocBasedTaggingCriteria, self).__init__(**kwargs) - self.tag_info = kwargs.get('tag_info', None) - - -class TriggerContext(msrest.serialization.Model): - """Trigger context. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AdhocBasedTriggerContext, ScheduleBasedTriggerContext. - - All required parameters must be populated in order to send to Azure. - - :param object_type: Required. Type of the specific object - used for deserializing.Constant - filled by server. - :type object_type: str - """ - - _validation = { - 'object_type': {'required': True}, - } - - _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - } - - _subtype_map = { - 'object_type': {'AdhocBasedTriggerContext': 'AdhocBasedTriggerContext', 'ScheduleBasedTriggerContext': 'ScheduleBasedTriggerContext'} - } - - def __init__( - self, - **kwargs - ): - super(TriggerContext, self).__init__(**kwargs) - self.object_type = None # type: Optional[str] - - -class AdhocBasedTriggerContext(TriggerContext): - """Adhoc trigger context. - - All required parameters must be populated in order to send to Azure. - - :param object_type: Required. Type of the specific object - used for deserializing.Constant - filled by server. - :type object_type: str - :param tagging_criteria: Required. Tagging Criteria containing retention tag for adhoc backup. - :type tagging_criteria: ~azure.mgmt.dataprotection.models.AdhocBasedTaggingCriteria - """ - - _validation = { - 'object_type': {'required': True}, - 'tagging_criteria': {'required': True}, - } - - _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'tagging_criteria': {'key': 'taggingCriteria', 'type': 'AdhocBasedTaggingCriteria'}, - } - - def __init__( - self, - **kwargs - ): - super(AdhocBasedTriggerContext, self).__init__(**kwargs) - self.object_type = 'AdhocBasedTriggerContext' # type: str - self.tagging_criteria = kwargs['tagging_criteria'] - - -class AuthCredentials(msrest.serialization.Model): - """Base class for different types of authentication credentials. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: SecretStoreBasedAuthCredentials. - - All required parameters must be populated in order to send to Azure. - - :param object_type: Required. Type of the specific object - used for deserializing.Constant - filled by server. - :type object_type: str - """ - - _validation = { - 'object_type': {'required': True}, - } - - _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - } - - _subtype_map = { - 'object_type': {'SecretStoreBasedAuthCredentials': 'SecretStoreBasedAuthCredentials'} - } - - def __init__( - self, - **kwargs - ): - super(AuthCredentials, self).__init__(**kwargs) - self.object_type = None # type: Optional[str] - - -class AzureBackupRecoveryPoint(msrest.serialization.Model): - """Azure backup recoveryPoint. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureBackupDiscreteRecoveryPoint. - - All required parameters must be populated in order to send to Azure. - - :param object_type: Required. Constant filled by server. - :type object_type: str - """ - - _validation = { - 'object_type': {'required': True}, - } - - _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - } - - _subtype_map = { - 'object_type': {'AzureBackupDiscreteRecoveryPoint': 'AzureBackupDiscreteRecoveryPoint'} - } - - def __init__( - self, - **kwargs - ): - super(AzureBackupRecoveryPoint, self).__init__(**kwargs) - self.object_type = None # type: Optional[str] - - -class AzureBackupDiscreteRecoveryPoint(AzureBackupRecoveryPoint): - """Azure backup discrete RecoveryPoint. - - All required parameters must be populated in order to send to Azure. - - :param object_type: Required. Constant filled by server. - :type object_type: str - :param friendly_name: - :type friendly_name: str - :param recovery_point_data_stores_details: - :type recovery_point_data_stores_details: - list[~azure.mgmt.dataprotection.models.RecoveryPointDataStoreDetails] - :param recovery_point_time: Required. - :type recovery_point_time: ~datetime.datetime - :param policy_name: - :type policy_name: str - :param policy_version: - :type policy_version: str - :param recovery_point_id: - :type recovery_point_id: str - :param recovery_point_type: - :type recovery_point_type: str - :param retention_tag_name: - :type retention_tag_name: str - :param retention_tag_version: - :type retention_tag_version: str - """ - - _validation = { - 'object_type': {'required': True}, - 'recovery_point_time': {'required': True}, - } - - _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'recovery_point_data_stores_details': {'key': 'recoveryPointDataStoresDetails', 'type': '[RecoveryPointDataStoreDetails]'}, - 'recovery_point_time': {'key': 'recoveryPointTime', 'type': 'iso-8601'}, - 'policy_name': {'key': 'policyName', 'type': 'str'}, - 'policy_version': {'key': 'policyVersion', 'type': 'str'}, - 'recovery_point_id': {'key': 'recoveryPointId', 'type': 'str'}, - 'recovery_point_type': {'key': 'recoveryPointType', 'type': 'str'}, - 'retention_tag_name': {'key': 'retentionTagName', 'type': 'str'}, - 'retention_tag_version': {'key': 'retentionTagVersion', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureBackupDiscreteRecoveryPoint, self).__init__(**kwargs) - self.object_type = 'AzureBackupDiscreteRecoveryPoint' # type: str - self.friendly_name = kwargs.get('friendly_name', None) - self.recovery_point_data_stores_details = kwargs.get('recovery_point_data_stores_details', None) - self.recovery_point_time = kwargs['recovery_point_time'] - self.policy_name = kwargs.get('policy_name', None) - self.policy_version = kwargs.get('policy_version', None) - self.recovery_point_id = kwargs.get('recovery_point_id', None) - self.recovery_point_type = kwargs.get('recovery_point_type', None) - self.retention_tag_name = kwargs.get('retention_tag_name', None) - self.retention_tag_version = kwargs.get('retention_tag_version', None) - - -class AzureBackupFindRestorableTimeRangesRequest(msrest.serialization.Model): - """List Restore Ranges Request. - - All required parameters must be populated in order to send to Azure. - - :param source_data_store_type: Required. Gets or sets the type of the source data store. - Possible values include: "OperationalStore", "VaultStore", "ArchiveStore". - :type source_data_store_type: str or - ~azure.mgmt.dataprotection.models.RestoreSourceDataStoreType - :param start_time: Start time for the List Restore Ranges request. ISO 8601 format. - :type start_time: str - :param end_time: End time for the List Restore Ranges request. ISO 8601 format. - :type end_time: str - """ - - _validation = { - 'source_data_store_type': {'required': True}, - } - - _attribute_map = { - 'source_data_store_type': {'key': 'sourceDataStoreType', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'str'}, - 'end_time': {'key': 'endTime', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureBackupFindRestorableTimeRangesRequest, self).__init__(**kwargs) - self.source_data_store_type = kwargs['source_data_store_type'] - self.start_time = kwargs.get('start_time', None) - self.end_time = kwargs.get('end_time', None) - - -class DppWorkerRequest(msrest.serialization.Model): - """DppWorkerRequest. - - :param subscription_id: - :type subscription_id: str - :param uri: - :type uri: str - :param headers: Dictionary of - . - :type headers: dict[str, list[str]] - :param supported_group_versions: - :type supported_group_versions: list[str] - :param culture_info: - :type culture_info: str - :param parameters: Dictionary of :code:``. - :type parameters: dict[str, str] - :param http_method: - :type http_method: str - """ - - _attribute_map = { - 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, - 'uri': {'key': 'uri', 'type': 'str'}, - 'headers': {'key': 'headers', 'type': '{[str]}'}, - 'supported_group_versions': {'key': 'supportedGroupVersions', 'type': '[str]'}, - 'culture_info': {'key': 'cultureInfo', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': '{str}'}, - 'http_method': {'key': 'httpMethod', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DppWorkerRequest, self).__init__(**kwargs) - self.subscription_id = kwargs.get('subscription_id', None) - self.uri = kwargs.get('uri', None) - self.headers = kwargs.get('headers', None) - self.supported_group_versions = kwargs.get('supported_group_versions', None) - self.culture_info = kwargs.get('culture_info', None) - self.parameters = kwargs.get('parameters', None) - self.http_method = kwargs.get('http_method', None) - - -class AzureBackupFindRestorableTimeRangesRequestResource(DppWorkerRequest): - """List Restore Ranges Request. - - :param subscription_id: - :type subscription_id: str - :param uri: - :type uri: str - :param headers: Dictionary of - . - :type headers: dict[str, list[str]] - :param supported_group_versions: - :type supported_group_versions: list[str] - :param culture_info: - :type culture_info: str - :param parameters: Dictionary of :code:``. - :type parameters: dict[str, str] - :param http_method: - :type http_method: str - :param content: AzureBackupFindRestorableTimeRangesRequestResource content. - :type content: ~azure.mgmt.dataprotection.models.AzureBackupFindRestorableTimeRangesRequest - """ - - _attribute_map = { - 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, - 'uri': {'key': 'uri', 'type': 'str'}, - 'headers': {'key': 'headers', 'type': '{[str]}'}, - 'supported_group_versions': {'key': 'supportedGroupVersions', 'type': '[str]'}, - 'culture_info': {'key': 'cultureInfo', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': '{str}'}, - 'http_method': {'key': 'httpMethod', 'type': 'str'}, - 'content': {'key': 'content', 'type': 'AzureBackupFindRestorableTimeRangesRequest'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureBackupFindRestorableTimeRangesRequestResource, self).__init__(**kwargs) - self.content = kwargs.get('content', None) - - -class AzureBackupFindRestorableTimeRangesResponse(msrest.serialization.Model): - """List Restore Ranges Response. - - :param restorable_time_ranges: Returns the Restore Ranges available on the Backup Instance. - :type restorable_time_ranges: list[~azure.mgmt.dataprotection.models.RestorableTimeRange] - :param object_type: - :type object_type: str - """ - - _attribute_map = { - 'restorable_time_ranges': {'key': 'restorableTimeRanges', 'type': '[RestorableTimeRange]'}, - 'object_type': {'key': 'objectType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureBackupFindRestorableTimeRangesResponse, self).__init__(**kwargs) - self.restorable_time_ranges = kwargs.get('restorable_time_ranges', None) - self.object_type = kwargs.get('object_type', None) - - -class DppResource(msrest.serialization.Model): - """Resource class. - - 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 - """ - - _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'}, - } - - def __init__( - self, - **kwargs - ): - super(DppResource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = None - - -class AzureBackupFindRestorableTimeRangesResponseResource(DppResource): - """List Restore Ranges Response. - - 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 - :param properties: AzureBackupFindRestorableTimeRangesResponseResource properties. - :type properties: ~azure.mgmt.dataprotection.models.AzureBackupFindRestorableTimeRangesResponse - """ - - _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': 'AzureBackupFindRestorableTimeRangesResponse'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureBackupFindRestorableTimeRangesResponseResource, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class AzureBackupJob(msrest.serialization.Model): - """AzureBackup Job Class. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param activity_id: Required. Job Activity Id. - :type activity_id: str - :param backup_instance_friendly_name: Required. Name of the Backup Instance. - :type backup_instance_friendly_name: str - :ivar backup_instance_id: ARM ID of the Backup Instance. - :vartype backup_instance_id: str - :param data_source_id: Required. ARM ID of the DataSource. - :type data_source_id: str - :param data_source_location: Required. Location of the DataSource. - :type data_source_location: str - :param data_source_name: Required. User Friendly Name of the DataSource. - :type data_source_name: str - :param data_source_set_name: Data Source Set Name of the DataSource. - :type data_source_set_name: str - :param data_source_type: Required. Type of DataSource. - :type data_source_type: str - :param duration: Total run time of the job. ISO 8601 format. - :type duration: str - :ivar end_time: EndTime of the job(in UTC). - :vartype end_time: ~datetime.datetime - :ivar error_details: A List, detailing the errors related to the job. - :vartype error_details: list[~azure.mgmt.dataprotection.models.UserFacingError] - :ivar extended_info: Extended Information about the job. - :vartype extended_info: ~azure.mgmt.dataprotection.models.JobExtendedInfo - :param is_user_triggered: Required. Indicated that whether the job is adhoc(true) or - scheduled(false). - :type is_user_triggered: bool - :param operation: Required. It indicates the type of Job i.e. Backup:full/log/diff - ;Restore:ALR/OLR; Tiering:Backup/Archive ; Management:ConfigureProtection/UnConfigure. - :type operation: str - :param operation_category: Required. It indicates the type of Job i.e. - Backup/Restore/Tiering/Management. - :type operation_category: str - :ivar policy_id: ARM ID of the policy. - :vartype policy_id: str - :ivar policy_name: Name of the policy. - :vartype policy_name: str - :param progress_enabled: Required. Indicated whether progress is enabled for the job. - :type progress_enabled: bool - :ivar progress_url: Url which contains job's progress. - :vartype progress_url: str - :ivar restore_type: It indicates the sub type of operation i.e. in case of Restore it can be - ALR/OLR. - :vartype restore_type: str - :param source_resource_group: Required. Resource Group Name of the Datasource. - :type source_resource_group: str - :param source_subscription_id: Required. SubscriptionId corresponding to the DataSource. - :type source_subscription_id: str - :param start_time: Required. StartTime of the job(in UTC). - :type start_time: ~datetime.datetime - :param status: Required. Status of the job like - InProgress/Success/Failed/Cancelled/SuccessWithWarning. - :type status: str - :param subscription_id: Required. Subscription Id of the corresponding backup vault. - :type subscription_id: str - :param supported_actions: Required. List of supported actions. - :type supported_actions: list[str] - :param vault_name: Required. Name of the vault. - :type vault_name: str - :param etag: - :type etag: str - :param source_data_store_name: - :type source_data_store_name: str - :param destination_data_store_name: - :type destination_data_store_name: str - """ - - _validation = { - 'activity_id': {'required': True}, - 'backup_instance_friendly_name': {'required': True}, - 'backup_instance_id': {'readonly': True}, - 'data_source_id': {'required': True}, - 'data_source_location': {'required': True}, - 'data_source_name': {'required': True}, - 'data_source_type': {'required': True}, - 'end_time': {'readonly': True}, - 'error_details': {'readonly': True}, - 'extended_info': {'readonly': True}, - 'is_user_triggered': {'required': True}, - 'operation': {'required': True}, - 'operation_category': {'required': True}, - 'policy_id': {'readonly': True}, - 'policy_name': {'readonly': True}, - 'progress_enabled': {'required': True}, - 'progress_url': {'readonly': True}, - 'restore_type': {'readonly': True}, - 'source_resource_group': {'required': True}, - 'source_subscription_id': {'required': True}, - 'start_time': {'required': True}, - 'status': {'required': True}, - 'subscription_id': {'required': True}, - 'supported_actions': {'required': True}, - 'vault_name': {'required': True}, - } - - _attribute_map = { - 'activity_id': {'key': 'activityID', 'type': 'str'}, - 'backup_instance_friendly_name': {'key': 'backupInstanceFriendlyName', 'type': 'str'}, - 'backup_instance_id': {'key': 'backupInstanceId', 'type': 'str'}, - 'data_source_id': {'key': 'dataSourceId', 'type': 'str'}, - 'data_source_location': {'key': 'dataSourceLocation', 'type': 'str'}, - 'data_source_name': {'key': 'dataSourceName', 'type': 'str'}, - 'data_source_set_name': {'key': 'dataSourceSetName', 'type': 'str'}, - 'data_source_type': {'key': 'dataSourceType', 'type': 'str'}, - 'duration': {'key': 'duration', 'type': 'str'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'error_details': {'key': 'errorDetails', 'type': '[UserFacingError]'}, - 'extended_info': {'key': 'extendedInfo', 'type': 'JobExtendedInfo'}, - 'is_user_triggered': {'key': 'isUserTriggered', 'type': 'bool'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'operation_category': {'key': 'operationCategory', 'type': 'str'}, - 'policy_id': {'key': 'policyId', 'type': 'str'}, - 'policy_name': {'key': 'policyName', 'type': 'str'}, - 'progress_enabled': {'key': 'progressEnabled', 'type': 'bool'}, - 'progress_url': {'key': 'progressUrl', 'type': 'str'}, - 'restore_type': {'key': 'restoreType', 'type': 'str'}, - 'source_resource_group': {'key': 'sourceResourceGroup', 'type': 'str'}, - 'source_subscription_id': {'key': 'sourceSubscriptionID', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'status': {'key': 'status', 'type': 'str'}, - 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, - 'supported_actions': {'key': 'supportedActions', 'type': '[str]'}, - 'vault_name': {'key': 'vaultName', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'source_data_store_name': {'key': 'sourceDataStoreName', 'type': 'str'}, - 'destination_data_store_name': {'key': 'destinationDataStoreName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureBackupJob, self).__init__(**kwargs) - self.activity_id = kwargs['activity_id'] - self.backup_instance_friendly_name = kwargs['backup_instance_friendly_name'] - self.backup_instance_id = None - self.data_source_id = kwargs['data_source_id'] - self.data_source_location = kwargs['data_source_location'] - self.data_source_name = kwargs['data_source_name'] - self.data_source_set_name = kwargs.get('data_source_set_name', None) - self.data_source_type = kwargs['data_source_type'] - self.duration = kwargs.get('duration', None) - self.end_time = None - self.error_details = None - self.extended_info = None - self.is_user_triggered = kwargs['is_user_triggered'] - self.operation = kwargs['operation'] - self.operation_category = kwargs['operation_category'] - self.policy_id = None - self.policy_name = None - self.progress_enabled = kwargs['progress_enabled'] - self.progress_url = None - self.restore_type = None - self.source_resource_group = kwargs['source_resource_group'] - self.source_subscription_id = kwargs['source_subscription_id'] - self.start_time = kwargs['start_time'] - self.status = kwargs['status'] - self.subscription_id = kwargs['subscription_id'] - self.supported_actions = kwargs['supported_actions'] - self.vault_name = kwargs['vault_name'] - self.etag = kwargs.get('etag', None) - self.source_data_store_name = kwargs.get('source_data_store_name', None) - self.destination_data_store_name = kwargs.get('destination_data_store_name', None) - - -class AzureBackupJobResource(DppResource): - """AzureBackup Job Resource Class. - - 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 - :param properties: AzureBackupJobResource properties. - :type properties: ~azure.mgmt.dataprotection.models.AzureBackupJob - """ - - _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': 'AzureBackupJob'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureBackupJobResource, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class DppResourceList(msrest.serialization.Model): - """ListResource. - - :param next_link: The uri to fetch the next page of resources. Call ListNext() fetches next - page of resources. - :type next_link: str - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DppResourceList, self).__init__(**kwargs) - self.next_link = kwargs.get('next_link', None) - - -class AzureBackupJobResourceList(DppResourceList): - """List of AzureBackup Job resources. - - :param next_link: The uri to fetch the next page of resources. Call ListNext() fetches next - page of resources. - :type next_link: str - :param value: List of resources. - :type value: list[~azure.mgmt.dataprotection.models.AzureBackupJobResource] - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[AzureBackupJobResource]'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureBackupJobResourceList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class BackupParameters(msrest.serialization.Model): - """BackupParameters base. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureBackupParams. - - All required parameters must be populated in order to send to Azure. - - :param object_type: Required. Type of the specific object - used for deserializing.Constant - filled by server. - :type object_type: str - """ - - _validation = { - 'object_type': {'required': True}, - } - - _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - } - - _subtype_map = { - 'object_type': {'AzureBackupParams': 'AzureBackupParams'} - } - - def __init__( - self, - **kwargs - ): - super(BackupParameters, self).__init__(**kwargs) - self.object_type = None # type: Optional[str] - - -class AzureBackupParams(BackupParameters): - """Azure backup parameters. - - All required parameters must be populated in order to send to Azure. - - :param object_type: Required. Type of the specific object - used for deserializing.Constant - filled by server. - :type object_type: str - :param backup_type: Required. BackupType ; Full/Incremental etc. - :type backup_type: str - """ - - _validation = { - 'object_type': {'required': True}, - 'backup_type': {'required': True}, - } - - _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'backup_type': {'key': 'backupType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureBackupParams, self).__init__(**kwargs) - self.object_type = 'AzureBackupParams' # type: str - self.backup_type = kwargs['backup_type'] - - -class AzureBackupRestoreRequest(msrest.serialization.Model): - """Azure backup restore request. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureBackupRecoveryPointBasedRestoreRequest, AzureBackupRecoveryTimeBasedRestoreRequest. - - All required parameters must be populated in order to send to Azure. - - :param object_type: Required. Constant filled by server. - :type object_type: str - :param restore_target_info: Required. Gets or sets the restore target information. - :type restore_target_info: ~azure.mgmt.dataprotection.models.RestoreTargetInfoBase - :param source_data_store_type: Required. Gets or sets the type of the source data store. - Possible values include: "ArchiveStore", "SnapshotStore", "VaultStore". - :type source_data_store_type: str or ~azure.mgmt.dataprotection.models.SourceDataStoreType - """ - - _validation = { - 'object_type': {'required': True}, - 'restore_target_info': {'required': True}, - 'source_data_store_type': {'required': True}, - } - - _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'restore_target_info': {'key': 'restoreTargetInfo', 'type': 'RestoreTargetInfoBase'}, - 'source_data_store_type': {'key': 'sourceDataStoreType', 'type': 'str'}, - } - - _subtype_map = { - 'object_type': {'AzureBackupRecoveryPointBasedRestoreRequest': 'AzureBackupRecoveryPointBasedRestoreRequest', 'AzureBackupRecoveryTimeBasedRestoreRequest': 'AzureBackupRecoveryTimeBasedRestoreRequest'} - } - - def __init__( - self, - **kwargs - ): - super(AzureBackupRestoreRequest, self).__init__(**kwargs) - self.object_type = None # type: Optional[str] - self.restore_target_info = kwargs['restore_target_info'] - self.source_data_store_type = kwargs['source_data_store_type'] - - -class AzureBackupRecoveryPointBasedRestoreRequest(AzureBackupRestoreRequest): - """Azure backup recoveryPoint based restore request. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureBackupRestoreWithRehydrationRequest. - - All required parameters must be populated in order to send to Azure. - - :param object_type: Required. Constant filled by server. - :type object_type: str - :param restore_target_info: Required. Gets or sets the restore target information. - :type restore_target_info: ~azure.mgmt.dataprotection.models.RestoreTargetInfoBase - :param source_data_store_type: Required. Gets or sets the type of the source data store. - Possible values include: "ArchiveStore", "SnapshotStore", "VaultStore". - :type source_data_store_type: str or ~azure.mgmt.dataprotection.models.SourceDataStoreType - :param recovery_point_id: Required. - :type recovery_point_id: str - """ - - _validation = { - 'object_type': {'required': True}, - 'restore_target_info': {'required': True}, - 'source_data_store_type': {'required': True}, - 'recovery_point_id': {'required': True}, - } - - _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'restore_target_info': {'key': 'restoreTargetInfo', 'type': 'RestoreTargetInfoBase'}, - 'source_data_store_type': {'key': 'sourceDataStoreType', 'type': 'str'}, - 'recovery_point_id': {'key': 'recoveryPointId', 'type': 'str'}, - } - - _subtype_map = { - 'object_type': {'AzureBackupRestoreWithRehydrationRequest': 'AzureBackupRestoreWithRehydrationRequest'} - } - - def __init__( - self, - **kwargs - ): - super(AzureBackupRecoveryPointBasedRestoreRequest, self).__init__(**kwargs) - self.object_type = 'AzureBackupRecoveryPointBasedRestoreRequest' # type: str - self.recovery_point_id = kwargs['recovery_point_id'] - - -class AzureBackupRecoveryPointResource(DppResource): - """Azure backup recoveryPoint resource. - - 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 - :param properties: AzureBackupRecoveryPointResource properties. - :type properties: ~azure.mgmt.dataprotection.models.AzureBackupRecoveryPoint - """ - - _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': 'AzureBackupRecoveryPoint'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureBackupRecoveryPointResource, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class AzureBackupRecoveryPointResourceList(DppResourceList): - """Azure backup recoveryPoint resource list. - - :param next_link: The uri to fetch the next page of resources. Call ListNext() fetches next - page of resources. - :type next_link: str - :param value: List of resources. - :type value: list[~azure.mgmt.dataprotection.models.AzureBackupRecoveryPointResource] - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[AzureBackupRecoveryPointResource]'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureBackupRecoveryPointResourceList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class AzureBackupRecoveryTimeBasedRestoreRequest(AzureBackupRestoreRequest): - """AzureBackup RecoveryPointTime Based Restore Request. - - All required parameters must be populated in order to send to Azure. - - :param object_type: Required. Constant filled by server. - :type object_type: str - :param restore_target_info: Required. Gets or sets the restore target information. - :type restore_target_info: ~azure.mgmt.dataprotection.models.RestoreTargetInfoBase - :param source_data_store_type: Required. Gets or sets the type of the source data store. - Possible values include: "ArchiveStore", "SnapshotStore", "VaultStore". - :type source_data_store_type: str or ~azure.mgmt.dataprotection.models.SourceDataStoreType - :param recovery_point_time: Required. The recovery time in ISO 8601 format example - - 2020-08-14T17:30:00.0000000Z. - :type recovery_point_time: str - """ - - _validation = { - 'object_type': {'required': True}, - 'restore_target_info': {'required': True}, - 'source_data_store_type': {'required': True}, - 'recovery_point_time': {'required': True}, - } - - _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'restore_target_info': {'key': 'restoreTargetInfo', 'type': 'RestoreTargetInfoBase'}, - 'source_data_store_type': {'key': 'sourceDataStoreType', 'type': 'str'}, - 'recovery_point_time': {'key': 'recoveryPointTime', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureBackupRecoveryTimeBasedRestoreRequest, self).__init__(**kwargs) - self.object_type = 'AzureBackupRecoveryTimeBasedRestoreRequest' # type: str - self.recovery_point_time = kwargs['recovery_point_time'] - - -class AzureBackupRehydrationRequest(msrest.serialization.Model): - """Azure Backup Rehydrate Request. - - All required parameters must be populated in order to send to Azure. - - :param recovery_point_id: Required. Id of the recovery point to be recovered. - :type recovery_point_id: str - :param rehydration_priority: Priority to be used for rehydration. Values High or Standard. - Possible values include: "Invalid", "High", "Standard". - :type rehydration_priority: str or ~azure.mgmt.dataprotection.models.RehydrationPriority - :param rehydration_retention_duration: Required. Retention duration in ISO 8601 format i.e P10D - . - :type rehydration_retention_duration: str - """ - - _validation = { - 'recovery_point_id': {'required': True}, - 'rehydration_retention_duration': {'required': True}, - } - - _attribute_map = { - 'recovery_point_id': {'key': 'recoveryPointId', 'type': 'str'}, - 'rehydration_priority': {'key': 'rehydrationPriority', 'type': 'str'}, - 'rehydration_retention_duration': {'key': 'rehydrationRetentionDuration', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureBackupRehydrationRequest, self).__init__(**kwargs) - self.recovery_point_id = kwargs['recovery_point_id'] - self.rehydration_priority = kwargs.get('rehydration_priority', None) - self.rehydration_retention_duration = kwargs['rehydration_retention_duration'] - - -class AzureBackupRestoreWithRehydrationRequest(AzureBackupRecoveryPointBasedRestoreRequest): - """AzureBackup Restore with Rehydration Request. - - All required parameters must be populated in order to send to Azure. - - :param object_type: Required. Constant filled by server. - :type object_type: str - :param restore_target_info: Required. Gets or sets the restore target information. - :type restore_target_info: ~azure.mgmt.dataprotection.models.RestoreTargetInfoBase - :param source_data_store_type: Required. Gets or sets the type of the source data store. - Possible values include: "ArchiveStore", "SnapshotStore", "VaultStore". - :type source_data_store_type: str or ~azure.mgmt.dataprotection.models.SourceDataStoreType - :param recovery_point_id: Required. - :type recovery_point_id: str - :param rehydration_priority: Required. Priority to be used for rehydration. Values High or - Standard. Possible values include: "Invalid", "High", "Standard". - :type rehydration_priority: str or ~azure.mgmt.dataprotection.models.RehydrationPriority - :param rehydration_retention_duration: Required. Retention duration in ISO 8601 format i.e P10D - . - :type rehydration_retention_duration: str - """ - - _validation = { - 'object_type': {'required': True}, - 'restore_target_info': {'required': True}, - 'source_data_store_type': {'required': True}, - 'recovery_point_id': {'required': True}, - 'rehydration_priority': {'required': True}, - 'rehydration_retention_duration': {'required': True}, - } - - _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'restore_target_info': {'key': 'restoreTargetInfo', 'type': 'RestoreTargetInfoBase'}, - 'source_data_store_type': {'key': 'sourceDataStoreType', 'type': 'str'}, - 'recovery_point_id': {'key': 'recoveryPointId', 'type': 'str'}, - 'rehydration_priority': {'key': 'rehydrationPriority', 'type': 'str'}, - 'rehydration_retention_duration': {'key': 'rehydrationRetentionDuration', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureBackupRestoreWithRehydrationRequest, self).__init__(**kwargs) - self.object_type = 'AzureBackupRestoreWithRehydrationRequest' # type: str - self.rehydration_priority = kwargs['rehydration_priority'] - self.rehydration_retention_duration = kwargs['rehydration_retention_duration'] - - -class BasePolicyRule(msrest.serialization.Model): - """BasePolicy Rule. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureBackupRule, AzureRetentionRule. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. - :type name: str - :param object_type: Required. Constant filled by server. - :type object_type: str - """ - - _validation = { - 'name': {'required': True}, - 'object_type': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'object_type': {'key': 'objectType', 'type': 'str'}, - } - - _subtype_map = { - 'object_type': {'AzureBackupRule': 'AzureBackupRule', 'AzureRetentionRule': 'AzureRetentionRule'} - } - - def __init__( - self, - **kwargs - ): - super(BasePolicyRule, self).__init__(**kwargs) - self.name = kwargs['name'] - self.object_type = None # type: Optional[str] - - -class AzureBackupRule(BasePolicyRule): - """Azure backup rule. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. - :type name: str - :param object_type: Required. Constant filled by server. - :type object_type: str - :param backup_parameters: BackupParameters base. - :type backup_parameters: ~azure.mgmt.dataprotection.models.BackupParameters - :param data_store: Required. DataStoreInfo base. - :type data_store: ~azure.mgmt.dataprotection.models.DataStoreInfoBase - :param trigger: Required. Trigger context. - :type trigger: ~azure.mgmt.dataprotection.models.TriggerContext - """ - - _validation = { - 'name': {'required': True}, - 'object_type': {'required': True}, - 'data_store': {'required': True}, - 'trigger': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'backup_parameters': {'key': 'backupParameters', 'type': 'BackupParameters'}, - 'data_store': {'key': 'dataStore', 'type': 'DataStoreInfoBase'}, - 'trigger': {'key': 'trigger', 'type': 'TriggerContext'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureBackupRule, self).__init__(**kwargs) - self.object_type = 'AzureBackupRule' # type: str - self.backup_parameters = kwargs.get('backup_parameters', None) - self.data_store = kwargs['data_store'] - self.trigger = kwargs['trigger'] - - -class DataStoreParameters(msrest.serialization.Model): - """Parameters for DataStore. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureOperationalStoreParameters. - - All required parameters must be populated in order to send to Azure. - - :param object_type: Required. Type of the specific object - used for deserializing.Constant - filled by server. - :type object_type: str - :param data_store_type: Required. type of datastore; Operational/Vault/Archive. Possible values - include: "OperationalStore", "VaultStore", "ArchiveStore". - :type data_store_type: str or ~azure.mgmt.dataprotection.models.DataStoreTypes - """ - - _validation = { - 'object_type': {'required': True}, - 'data_store_type': {'required': True}, - } - - _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'data_store_type': {'key': 'dataStoreType', 'type': 'str'}, - } - - _subtype_map = { - 'object_type': {'AzureOperationalStoreParameters': 'AzureOperationalStoreParameters'} - } - - def __init__( - self, - **kwargs - ): - super(DataStoreParameters, self).__init__(**kwargs) - self.object_type = None # type: Optional[str] - self.data_store_type = kwargs['data_store_type'] - - -class AzureOperationalStoreParameters(DataStoreParameters): - """Parameters for Operational-Tier DataStore. - - All required parameters must be populated in order to send to Azure. - - :param object_type: Required. Type of the specific object - used for deserializing.Constant - filled by server. - :type object_type: str - :param data_store_type: Required. type of datastore; Operational/Vault/Archive. Possible values - include: "OperationalStore", "VaultStore", "ArchiveStore". - :type data_store_type: str or ~azure.mgmt.dataprotection.models.DataStoreTypes - :param resource_group_id: Gets or sets the Snapshot Resource Group Uri. - :type resource_group_id: str - """ - - _validation = { - 'object_type': {'required': True}, - 'data_store_type': {'required': True}, - } - - _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'data_store_type': {'key': 'dataStoreType', 'type': 'str'}, - 'resource_group_id': {'key': 'resourceGroupId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureOperationalStoreParameters, self).__init__(**kwargs) - self.object_type = 'AzureOperationalStoreParameters' # type: str - self.resource_group_id = kwargs.get('resource_group_id', None) - - -class AzureRetentionRule(BasePolicyRule): - """Azure retention rule. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. - :type name: str - :param object_type: Required. Constant filled by server. - :type object_type: str - :param is_default: - :type is_default: bool - :param lifecycles: Required. - :type lifecycles: list[~azure.mgmt.dataprotection.models.SourceLifeCycle] - """ - - _validation = { - 'name': {'required': True}, - 'object_type': {'required': True}, - 'lifecycles': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'is_default': {'key': 'isDefault', 'type': 'bool'}, - 'lifecycles': {'key': 'lifecycles', 'type': '[SourceLifeCycle]'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureRetentionRule, self).__init__(**kwargs) - self.object_type = 'AzureRetentionRule' # type: str - self.is_default = kwargs.get('is_default', None) - self.lifecycles = kwargs['lifecycles'] - - -class BackupCriteria(msrest.serialization.Model): - """BackupCriteria base class. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: ScheduleBasedBackupCriteria. - - All required parameters must be populated in order to send to Azure. - - :param object_type: Required. Type of the specific object - used for deserializing.Constant - filled by server. - :type object_type: str - """ - - _validation = { - 'object_type': {'required': True}, - } - - _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - } - - _subtype_map = { - 'object_type': {'ScheduleBasedBackupCriteria': 'ScheduleBasedBackupCriteria'} - } - - def __init__( - self, - **kwargs - ): - super(BackupCriteria, self).__init__(**kwargs) - self.object_type = None # type: Optional[str] - - -class BackupInstance(msrest.serialization.Model): - """Backup Instance. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param friendly_name: Gets or sets the Backup Instance friendly name. - :type friendly_name: str - :param data_source_info: Required. Gets or sets the data source information. - :type data_source_info: ~azure.mgmt.dataprotection.models.Datasource - :param data_source_set_info: Gets or sets the data source set information. - :type data_source_set_info: ~azure.mgmt.dataprotection.models.DatasourceSet - :param policy_info: Required. Gets or sets the policy information. - :type policy_info: ~azure.mgmt.dataprotection.models.PolicyInfo - :ivar protection_status: Specifies the protection status of the resource. - :vartype protection_status: ~azure.mgmt.dataprotection.models.ProtectionStatusDetails - :ivar current_protection_state: Specifies the current protection state of the resource. - Possible values include: "Invalid", "NotProtected", "ConfiguringProtection", - "ProtectionConfigured", "BackupSchedulesSuspended", "RetentionSchedulesSuspended", - "ProtectionStopped", "ProtectionError", "ConfiguringProtectionFailed", "SoftDeleting", - "SoftDeleted", "UpdatingProtection". - :vartype current_protection_state: str or - ~azure.mgmt.dataprotection.models.CurrentProtectionState - :ivar protection_error_details: Specifies the protection error of the resource. - :vartype protection_error_details: ~azure.mgmt.dataprotection.models.UserFacingError - :ivar provisioning_state: Specifies the provisioning state of the resource i.e. - provisioning/updating/Succeeded/Failed. - :vartype provisioning_state: str - :param datasource_auth_credentials: Credentials to use to authenticate with data source - provider. - :type datasource_auth_credentials: ~azure.mgmt.dataprotection.models.AuthCredentials - :param object_type: Required. - :type object_type: str - """ - - _validation = { - 'data_source_info': {'required': True}, - 'policy_info': {'required': True}, - 'protection_status': {'readonly': True}, - 'current_protection_state': {'readonly': True}, - 'protection_error_details': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'object_type': {'required': True}, - } - - _attribute_map = { - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'data_source_info': {'key': 'dataSourceInfo', 'type': 'Datasource'}, - 'data_source_set_info': {'key': 'dataSourceSetInfo', 'type': 'DatasourceSet'}, - 'policy_info': {'key': 'policyInfo', 'type': 'PolicyInfo'}, - 'protection_status': {'key': 'protectionStatus', 'type': 'ProtectionStatusDetails'}, - 'current_protection_state': {'key': 'currentProtectionState', 'type': 'str'}, - 'protection_error_details': {'key': 'protectionErrorDetails', 'type': 'UserFacingError'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'datasource_auth_credentials': {'key': 'datasourceAuthCredentials', 'type': 'AuthCredentials'}, - 'object_type': {'key': 'objectType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(BackupInstance, self).__init__(**kwargs) - self.friendly_name = kwargs.get('friendly_name', None) - self.data_source_info = kwargs['data_source_info'] - self.data_source_set_info = kwargs.get('data_source_set_info', None) - self.policy_info = kwargs['policy_info'] - self.protection_status = None - self.current_protection_state = None - self.protection_error_details = None - self.provisioning_state = None - self.datasource_auth_credentials = kwargs.get('datasource_auth_credentials', None) - self.object_type = kwargs['object_type'] - - -class BackupInstanceResource(DppResource): - """BackupInstance Resource. - - 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 - :param properties: BackupInstanceResource properties. - :type properties: ~azure.mgmt.dataprotection.models.BackupInstance - """ - - _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': 'BackupInstance'}, - } - - def __init__( - self, - **kwargs - ): - super(BackupInstanceResource, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class BackupInstanceResourceList(DppResourceList): - """BackupInstance Resource list response. - - :param next_link: The uri to fetch the next page of resources. Call ListNext() fetches next - page of resources. - :type next_link: str - :param value: List of resources. - :type value: list[~azure.mgmt.dataprotection.models.BackupInstanceResource] - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[BackupInstanceResource]'}, - } - - def __init__( - self, - **kwargs - ): - super(BackupInstanceResourceList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class BaseBackupPolicy(msrest.serialization.Model): - """BackupPolicy base. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: BackupPolicy. - - All required parameters must be populated in order to send to Azure. - - :param datasource_types: Required. Type of datasource for the backup management. - :type datasource_types: list[str] - :param object_type: Required. Constant filled by server. - :type object_type: str - """ - - _validation = { - 'datasource_types': {'required': True}, - 'object_type': {'required': True}, - } - - _attribute_map = { - 'datasource_types': {'key': 'datasourceTypes', 'type': '[str]'}, - 'object_type': {'key': 'objectType', 'type': 'str'}, - } - - _subtype_map = { - 'object_type': {'BackupPolicy': 'BackupPolicy'} - } - - def __init__( - self, - **kwargs - ): - super(BaseBackupPolicy, self).__init__(**kwargs) - self.datasource_types = kwargs['datasource_types'] - self.object_type = None # type: Optional[str] - - -class BackupPolicy(BaseBackupPolicy): - """Rule based backup policy. - - All required parameters must be populated in order to send to Azure. - - :param datasource_types: Required. Type of datasource for the backup management. - :type datasource_types: list[str] - :param object_type: Required. Constant filled by server. - :type object_type: str - :param policy_rules: Required. Policy rule dictionary that contains rules for each backuptype - i.e Full/Incremental/Logs etc. - :type policy_rules: list[~azure.mgmt.dataprotection.models.BasePolicyRule] - """ - - _validation = { - 'datasource_types': {'required': True}, - 'object_type': {'required': True}, - 'policy_rules': {'required': True}, - } - - _attribute_map = { - 'datasource_types': {'key': 'datasourceTypes', 'type': '[str]'}, - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'policy_rules': {'key': 'policyRules', 'type': '[BasePolicyRule]'}, - } - - def __init__( - self, - **kwargs - ): - super(BackupPolicy, self).__init__(**kwargs) - self.object_type = 'BackupPolicy' # type: str - self.policy_rules = kwargs['policy_rules'] - - -class BackupSchedule(msrest.serialization.Model): - """Schedule for backup. - - All required parameters must be populated in order to send to Azure. - - :param repeating_time_intervals: Required. ISO 8601 repeating time interval format. - :type repeating_time_intervals: list[str] - :param time_zone: Time zone for a schedule. Example: Pacific Standard Time. - :type time_zone: str - """ - - _validation = { - 'repeating_time_intervals': {'required': True}, - } - - _attribute_map = { - 'repeating_time_intervals': {'key': 'repeatingTimeIntervals', 'type': '[str]'}, - 'time_zone': {'key': 'timeZone', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(BackupSchedule, self).__init__(**kwargs) - self.repeating_time_intervals = kwargs['repeating_time_intervals'] - self.time_zone = kwargs.get('time_zone', None) - - -class BackupVault(msrest.serialization.Model): - """Backup Vault. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar provisioning_state: Provisioning state of the BackupVault resource. Possible values - include: "Failed", "Provisioning", "Succeeded", "Unknown", "Updating". - :vartype provisioning_state: str or ~azure.mgmt.dataprotection.models.ProvisioningState - :ivar resource_move_state: Resource move state for backup vault. Possible values include: - "Unknown", "InProgress", "PrepareFailed", "CommitFailed", "Failed", "PrepareTimedout", - "CommitTimedout", "CriticalFailure", "PartialSuccess", "MoveSucceeded". - :vartype resource_move_state: str or ~azure.mgmt.dataprotection.models.ResourceMoveState - :ivar resource_move_details: Resource move details for backup vault. - :vartype resource_move_details: ~azure.mgmt.dataprotection.models.ResourceMoveDetails - :param storage_settings: Required. Storage Settings. - :type storage_settings: list[~azure.mgmt.dataprotection.models.StorageSetting] - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'resource_move_state': {'readonly': True}, - 'resource_move_details': {'readonly': True}, - 'storage_settings': {'required': True}, - } - - _attribute_map = { - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'resource_move_state': {'key': 'resourceMoveState', 'type': 'str'}, - 'resource_move_details': {'key': 'resourceMoveDetails', 'type': 'ResourceMoveDetails'}, - 'storage_settings': {'key': 'storageSettings', 'type': '[StorageSetting]'}, - } - - def __init__( - self, - **kwargs - ): - super(BackupVault, self).__init__(**kwargs) - self.provisioning_state = None - self.resource_move_state = None - self.resource_move_details = None - self.storage_settings = kwargs['storage_settings'] - - -class DppTrackedResource(msrest.serialization.Model): - """DppTrackedResource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param e_tag: Optional ETag. - :type e_tag: str - :ivar id: Resource Id represents the complete path to the resource. - :vartype id: str - :param identity: Input Managed Identity Details. - :type identity: ~azure.mgmt.dataprotection.models.DppIdentityDetails - :param location: Resource location. - :type location: str - :ivar name: Resource name associated with the resource. - :vartype name: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, 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 - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'e_tag': {'key': 'eTag', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'DppIdentityDetails'}, - 'location': {'key': 'location', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - **kwargs - ): - super(DppTrackedResource, self).__init__(**kwargs) - self.e_tag = kwargs.get('e_tag', None) - self.id = None - self.identity = kwargs.get('identity', None) - self.location = kwargs.get('location', None) - self.name = None - self.tags = kwargs.get('tags', None) - self.type = None - self.system_data = None - - -class BackupVaultResource(DppTrackedResource): - """Backup Vault Resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param e_tag: Optional ETag. - :type e_tag: str - :ivar id: Resource Id represents the complete path to the resource. - :vartype id: str - :param identity: Input Managed Identity Details. - :type identity: ~azure.mgmt.dataprotection.models.DppIdentityDetails - :param location: Resource location. - :type location: str - :ivar name: Resource name associated with the resource. - :vartype name: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, 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 - :param properties: Required. BackupVaultResource properties. - :type properties: ~azure.mgmt.dataprotection.models.BackupVault - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'properties': {'required': True}, - } - - _attribute_map = { - 'e_tag': {'key': 'eTag', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'DppIdentityDetails'}, - 'location': {'key': 'location', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'properties': {'key': 'properties', 'type': 'BackupVault'}, - } - - def __init__( - self, - **kwargs - ): - super(BackupVaultResource, self).__init__(**kwargs) - self.properties = kwargs['properties'] - - -class BackupVaultResourceList(DppResourceList): - """List of BackupVault resources. - - :param next_link: The uri to fetch the next page of resources. Call ListNext() fetches next - page of resources. - :type next_link: str - :param value: List of resources. - :type value: list[~azure.mgmt.dataprotection.models.BackupVaultResource] - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[BackupVaultResource]'}, - } - - def __init__( - self, - **kwargs - ): - super(BackupVaultResourceList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class BaseBackupPolicyResource(DppResource): - """BaseBackupPolicy resource. - - 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 - :param properties: BaseBackupPolicyResource properties. - :type properties: ~azure.mgmt.dataprotection.models.BaseBackupPolicy - """ - - _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': 'BaseBackupPolicy'}, - } - - def __init__( - self, - **kwargs - ): - super(BaseBackupPolicyResource, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class BaseBackupPolicyResourceList(DppResourceList): - """List of BaseBackupPolicy resources. - - :param next_link: The uri to fetch the next page of resources. Call ListNext() fetches next - page of resources. - :type next_link: str - :param value: List of resources. - :type value: list[~azure.mgmt.dataprotection.models.BaseBackupPolicyResource] - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[BaseBackupPolicyResource]'}, - } - - def __init__( - self, - **kwargs - ): - super(BaseBackupPolicyResourceList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class CheckNameAvailabilityRequest(msrest.serialization.Model): - """CheckNameAvailability Request. - - :param name: Resource name for which availability needs to be checked. - :type name: str - :param type: Describes the Resource type: Microsoft.DataProtection/BackupVaults. - :type type: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CheckNameAvailabilityRequest, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.type = kwargs.get('type', None) - - -class CheckNameAvailabilityResult(msrest.serialization.Model): - """CheckNameAvailability Result. - - :param message: Gets or sets the message. - :type message: str - :param name_available: Gets or sets a value indicating whether [name available]. - :type name_available: bool - :param reason: Gets or sets the reason. - :type reason: str - """ - - _attribute_map = { - 'message': {'key': 'message', 'type': 'str'}, - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CheckNameAvailabilityResult, self).__init__(**kwargs) - self.message = kwargs.get('message', None) - self.name_available = kwargs.get('name_available', None) - self.reason = kwargs.get('reason', None) - - -class ClientDiscoveryDisplay(msrest.serialization.Model): - """Localized display information of an operation. - - :param description: Description of the operation having details of what operation is about. - :type description: str - :param operation: Operations Name itself. - :type operation: str - :param provider: Name of the provider for display purposes. - :type provider: str - :param resource: ResourceType for which this Operation can be performed. - :type resource: str - """ - - _attribute_map = { - 'description': {'key': 'description', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ClientDiscoveryDisplay, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.operation = kwargs.get('operation', None) - self.provider = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - - -class ClientDiscoveryForLogSpecification(msrest.serialization.Model): - """Class to represent shoebox log specification in json client discovery. - - :param blob_duration: blob duration of shoebox log specification. - :type blob_duration: str - :param display_name: Localized display name. - :type display_name: str - :param name: Name for shoebox log specification. - :type name: str - """ - - _attribute_map = { - 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ClientDiscoveryForLogSpecification, self).__init__(**kwargs) - self.blob_duration = kwargs.get('blob_duration', None) - self.display_name = kwargs.get('display_name', None) - self.name = kwargs.get('name', None) - - -class ClientDiscoveryForProperties(msrest.serialization.Model): - """Class to represent shoebox properties in json client discovery. - - :param service_specification: Operation properties. - :type service_specification: - ~azure.mgmt.dataprotection.models.ClientDiscoveryForServiceSpecification - """ - - _attribute_map = { - 'service_specification': {'key': 'serviceSpecification', 'type': 'ClientDiscoveryForServiceSpecification'}, - } - - def __init__( - self, - **kwargs - ): - super(ClientDiscoveryForProperties, self).__init__(**kwargs) - self.service_specification = kwargs.get('service_specification', None) - - -class ClientDiscoveryForServiceSpecification(msrest.serialization.Model): - """Class to represent shoebox service specification in json client discovery. - - :param log_specifications: List of log specifications of this operation. - :type log_specifications: - list[~azure.mgmt.dataprotection.models.ClientDiscoveryForLogSpecification] - """ - - _attribute_map = { - 'log_specifications': {'key': 'logSpecifications', 'type': '[ClientDiscoveryForLogSpecification]'}, - } - - def __init__( - self, - **kwargs - ): - super(ClientDiscoveryForServiceSpecification, self).__init__(**kwargs) - self.log_specifications = kwargs.get('log_specifications', None) - - -class ClientDiscoveryResponse(msrest.serialization.Model): - """Operations List response which contains list of available APIs. - - :param next_link: Link to the next chunk of Response. - :type next_link: str - :param value: List of available operations. - :type value: list[~azure.mgmt.dataprotection.models.ClientDiscoveryValueForSingleApi] - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[ClientDiscoveryValueForSingleApi]'}, - } - - def __init__( - self, - **kwargs - ): - super(ClientDiscoveryResponse, self).__init__(**kwargs) - self.next_link = kwargs.get('next_link', None) - self.value = kwargs.get('value', None) - - -class ClientDiscoveryValueForSingleApi(msrest.serialization.Model): - """Available operation details. - - :param display: Contains the localized display information for this particular operation. - :type display: ~azure.mgmt.dataprotection.models.ClientDiscoveryDisplay - :param name: Name of the Operation. - :type name: str - :param is_data_action: Indicates whether the operation is a data action. - :type is_data_action: bool - :param origin: The intended executor of the operation;governs the display of the operation in - the RBAC UX and the audit logs UX. - :type origin: str - :param properties: Properties for the given operation. - :type properties: ~azure.mgmt.dataprotection.models.ClientDiscoveryForProperties - """ - - _attribute_map = { - 'display': {'key': 'display', 'type': 'ClientDiscoveryDisplay'}, - 'name': {'key': 'name', 'type': 'str'}, - 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'ClientDiscoveryForProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(ClientDiscoveryValueForSingleApi, self).__init__(**kwargs) - self.display = kwargs.get('display', None) - self.name = kwargs.get('name', None) - self.is_data_action = kwargs.get('is_data_action', None) - self.origin = kwargs.get('origin', None) - self.properties = kwargs.get('properties', None) - - -class CopyOption(msrest.serialization.Model): - """Options to copy. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: CopyOnExpiryOption, CustomCopyOption, ImmediateCopyOption. - - All required parameters must be populated in order to send to Azure. - - :param object_type: Required. Type of the specific object - used for deserializing.Constant - filled by server. - :type object_type: str - """ - - _validation = { - 'object_type': {'required': True}, - } - - _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - } - - _subtype_map = { - 'object_type': {'CopyOnExpiryOption': 'CopyOnExpiryOption', 'CustomCopyOption': 'CustomCopyOption', 'ImmediateCopyOption': 'ImmediateCopyOption'} - } - - def __init__( - self, - **kwargs - ): - super(CopyOption, self).__init__(**kwargs) - self.object_type = None # type: Optional[str] - - -class CopyOnExpiryOption(CopyOption): - """Copy on Expiry Option. - - All required parameters must be populated in order to send to Azure. - - :param object_type: Required. Type of the specific object - used for deserializing.Constant - filled by server. - :type object_type: str - """ - - _validation = { - 'object_type': {'required': True}, - } - - _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CopyOnExpiryOption, self).__init__(**kwargs) - self.object_type = 'CopyOnExpiryOption' # type: str - - -class CustomCopyOption(CopyOption): - """Duration based custom options to copy. - - All required parameters must be populated in order to send to Azure. - - :param object_type: Required. Type of the specific object - used for deserializing.Constant - filled by server. - :type object_type: str - :param duration: Data copied after given timespan. - :type duration: str - """ - - _validation = { - 'object_type': {'required': True}, - } - - _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'duration': {'key': 'duration', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CustomCopyOption, self).__init__(**kwargs) - self.object_type = 'CustomCopyOption' # type: str - self.duration = kwargs.get('duration', None) - - -class Datasource(msrest.serialization.Model): - """Datasource to be backed up. - - All required parameters must be populated in order to send to Azure. - - :param datasource_type: DatasourceType of the resource. - :type datasource_type: str - :param object_type: Type of Datasource object, used to initialize the right inherited type. - :type object_type: str - :param resource_id: Required. Full ARM ID of the resource. For azure resources, this is ARM ID. - For non azure resources, this will be the ID created by backup service via Fabric/Vault. - :type resource_id: str - :param resource_location: Location of datasource. - :type resource_location: str - :param resource_name: Unique identifier of the resource in the context of parent. - :type resource_name: str - :param resource_type: Resource Type of Datasource. - :type resource_type: str - :param resource_uri: Uri of the resource. - :type resource_uri: str - """ - - _validation = { - 'resource_id': {'required': True}, - } - - _attribute_map = { - 'datasource_type': {'key': 'datasourceType', 'type': 'str'}, - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'resource_id': {'key': 'resourceID', 'type': 'str'}, - 'resource_location': {'key': 'resourceLocation', 'type': 'str'}, - 'resource_name': {'key': 'resourceName', 'type': 'str'}, - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'resource_uri': {'key': 'resourceUri', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Datasource, self).__init__(**kwargs) - self.datasource_type = kwargs.get('datasource_type', None) - self.object_type = kwargs.get('object_type', None) - self.resource_id = kwargs['resource_id'] - self.resource_location = kwargs.get('resource_location', None) - self.resource_name = kwargs.get('resource_name', None) - self.resource_type = kwargs.get('resource_type', None) - self.resource_uri = kwargs.get('resource_uri', None) - - -class DatasourceSet(msrest.serialization.Model): - """DatasourceSet details of datasource to be backed up. - - All required parameters must be populated in order to send to Azure. - - :param datasource_type: DatasourceType of the resource. - :type datasource_type: str - :param object_type: Type of Datasource object, used to initialize the right inherited type. - :type object_type: str - :param resource_id: Required. Full ARM ID of the resource. For azure resources, this is ARM ID. - For non azure resources, this will be the ID created by backup service via Fabric/Vault. - :type resource_id: str - :param resource_location: Location of datasource. - :type resource_location: str - :param resource_name: Unique identifier of the resource in the context of parent. - :type resource_name: str - :param resource_type: Resource Type of Datasource. - :type resource_type: str - :param resource_uri: Uri of the resource. - :type resource_uri: str - """ - - _validation = { - 'resource_id': {'required': True}, - } - - _attribute_map = { - 'datasource_type': {'key': 'datasourceType', 'type': 'str'}, - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'resource_id': {'key': 'resourceID', 'type': 'str'}, - 'resource_location': {'key': 'resourceLocation', 'type': 'str'}, - 'resource_name': {'key': 'resourceName', 'type': 'str'}, - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'resource_uri': {'key': 'resourceUri', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DatasourceSet, self).__init__(**kwargs) - self.datasource_type = kwargs.get('datasource_type', None) - self.object_type = kwargs.get('object_type', None) - self.resource_id = kwargs['resource_id'] - self.resource_location = kwargs.get('resource_location', None) - self.resource_name = kwargs.get('resource_name', None) - self.resource_type = kwargs.get('resource_type', None) - self.resource_uri = kwargs.get('resource_uri', None) - - -class DataStoreInfoBase(msrest.serialization.Model): - """DataStoreInfo base. - - All required parameters must be populated in order to send to Azure. - - :param data_store_type: Required. type of datastore; Operational/Vault/Archive. Possible values - include: "OperationalStore", "VaultStore", "ArchiveStore". - :type data_store_type: str or ~azure.mgmt.dataprotection.models.DataStoreTypes - :param object_type: Required. Type of Datasource object, used to initialize the right inherited - type. - :type object_type: str - """ - - _validation = { - 'data_store_type': {'required': True}, - 'object_type': {'required': True}, - } - - _attribute_map = { - 'data_store_type': {'key': 'dataStoreType', 'type': 'str'}, - 'object_type': {'key': 'objectType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DataStoreInfoBase, self).__init__(**kwargs) - self.data_store_type = kwargs['data_store_type'] - self.object_type = kwargs['object_type'] - - -class Day(msrest.serialization.Model): - """Day of the week. - - :param date: Date of the month. - :type date: int - :param is_last: Whether Date is last date of month. - :type is_last: bool - """ - - _attribute_map = { - 'date': {'key': 'date', 'type': 'int'}, - 'is_last': {'key': 'isLast', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(Day, self).__init__(**kwargs) - self.date = kwargs.get('date', None) - self.is_last = kwargs.get('is_last', None) - - -class DppBaseResource(msrest.serialization.Model): - """Base resource under Microsoft.DataProtection provider namespace. - - 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 - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DppBaseResource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class DppBaseResourceList(msrest.serialization.Model): - """Base for all lists of V2 resources. - - :param value: List of Dpp resources. - :type value: list[~azure.mgmt.dataprotection.models.DppBaseResource] - :param next_link: The uri to fetch the next page of resources. Call ListNext() fetches next - page of resources. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DppBaseResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DppBaseResourceList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class DppIdentityDetails(msrest.serialization.Model): - """Identity details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The object ID of the service principal object for the managed identity that - is used to grant role-based access to an Azure resource. - :vartype principal_id: str - :ivar tenant_id: A Globally Unique Identifier (GUID) that represents the Azure AD tenant where - the resource is now a member. - :vartype tenant_id: str - :param type: The identityType which can be either SystemAssigned or None. - :type type: str - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DppIdentityDetails, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = kwargs.get('type', None) - - -class DppTrackedResourceList(msrest.serialization.Model): - """DppTrackedResourceList. - - :param next_link: The uri to fetch the next page of resources. Call ListNext() fetches next - page of resources. - :type next_link: str - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DppTrackedResourceList, self).__init__(**kwargs) - self.next_link = kwargs.get('next_link', None) - - -class Error(msrest.serialization.Model): - """The resource management error response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar additional_info: The error additional info. - :vartype additional_info: list[~azure.mgmt.dataprotection.models.ErrorAdditionalInfo] - :ivar code: The error code. - :vartype code: str - :ivar details: The error details. - :vartype details: list[~azure.mgmt.dataprotection.models.Error] - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - """ - - _validation = { - 'additional_info': {'readonly': True}, - 'code': {'readonly': True}, - 'details': {'readonly': True}, - 'message': {'readonly': True}, - 'target': {'readonly': True}, - } - - _attribute_map = { - 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, - 'code': {'key': 'code', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[Error]'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Error, self).__init__(**kwargs) - self.additional_info = None - self.code = None - self.details = None - self.message = None - self.target = None - - -class ErrorAdditionalInfo(msrest.serialization.Model): - """The resource management error additional info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar info: The additional info. - :vartype info: any - :ivar type: The additional info type. - :vartype type: str - """ - - _validation = { - 'info': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'info': {'key': 'info', 'type': 'object'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorAdditionalInfo, self).__init__(**kwargs) - self.info = None - self.type = None - - -class ExportJobsResult(msrest.serialization.Model): - """The result for export jobs containing blob details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar blob_url: URL of the blob into which the serialized string of list of jobs is exported. - :vartype blob_url: str - :ivar blob_sas_key: SAS key to access the blob. - :vartype blob_sas_key: str - :ivar excel_file_blob_url: URL of the blob into which the ExcelFile is uploaded. - :vartype excel_file_blob_url: str - :ivar excel_file_blob_sas_key: SAS key to access the ExcelFile blob. - :vartype excel_file_blob_sas_key: str - """ - - _validation = { - 'blob_url': {'readonly': True}, - 'blob_sas_key': {'readonly': True}, - 'excel_file_blob_url': {'readonly': True}, - 'excel_file_blob_sas_key': {'readonly': True}, - } - - _attribute_map = { - 'blob_url': {'key': 'blobUrl', 'type': 'str'}, - 'blob_sas_key': {'key': 'blobSasKey', 'type': 'str'}, - 'excel_file_blob_url': {'key': 'excelFileBlobUrl', 'type': 'str'}, - 'excel_file_blob_sas_key': {'key': 'excelFileBlobSasKey', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExportJobsResult, self).__init__(**kwargs) - self.blob_url = None - self.blob_sas_key = None - self.excel_file_blob_url = None - self.excel_file_blob_sas_key = None - - -class FeatureValidationRequestBase(msrest.serialization.Model): - """Base class for Backup Feature support. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: FeatureValidationRequest. - - All required parameters must be populated in order to send to Azure. - - :param object_type: Required. Type of the specific object - used for deserializing.Constant - filled by server. - :type object_type: str - """ - - _validation = { - 'object_type': {'required': True}, - } - - _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - } - - _subtype_map = { - 'object_type': {'FeatureValidationRequest': 'FeatureValidationRequest'} - } - - def __init__( - self, - **kwargs - ): - super(FeatureValidationRequestBase, self).__init__(**kwargs) - self.object_type = None # type: Optional[str] - - -class FeatureValidationRequest(FeatureValidationRequestBase): - """Base class for feature object. - - All required parameters must be populated in order to send to Azure. - - :param object_type: Required. Type of the specific object - used for deserializing.Constant - filled by server. - :type object_type: str - :param feature_type: backup support feature type. Possible values include: "Invalid", - "DataSourceType". - :type feature_type: str or ~azure.mgmt.dataprotection.models.FeatureType - :param feature_name: backup support feature name. - :type feature_name: str - """ - - _validation = { - 'object_type': {'required': True}, - } - - _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'feature_type': {'key': 'featureType', 'type': 'str'}, - 'feature_name': {'key': 'featureName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(FeatureValidationRequest, self).__init__(**kwargs) - self.object_type = 'FeatureValidationRequest' # type: str - self.feature_type = kwargs.get('feature_type', None) - self.feature_name = kwargs.get('feature_name', None) - - -class FeatureValidationResponseBase(msrest.serialization.Model): - """Base class for Backup Feature support. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: FeatureValidationResponse. - - All required parameters must be populated in order to send to Azure. - - :param object_type: Required. Type of the specific object - used for deserializing.Constant - filled by server. - :type object_type: str - """ - - _validation = { - 'object_type': {'required': True}, - } - - _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - } - - _subtype_map = { - 'object_type': {'FeatureValidationResponse': 'FeatureValidationResponse'} - } - - def __init__( - self, - **kwargs - ): - super(FeatureValidationResponseBase, self).__init__(**kwargs) - self.object_type = None # type: Optional[str] - - -class FeatureValidationResponse(FeatureValidationResponseBase): - """Feature Validation Response. - - All required parameters must be populated in order to send to Azure. - - :param object_type: Required. Type of the specific object - used for deserializing.Constant - filled by server. - :type object_type: str - :param feature_type: backup support feature type. Possible values include: "Invalid", - "DataSourceType". - :type feature_type: str or ~azure.mgmt.dataprotection.models.FeatureType - :param features: Response features. - :type features: list[~azure.mgmt.dataprotection.models.SupportedFeature] - """ - - _validation = { - 'object_type': {'required': True}, - } - - _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'feature_type': {'key': 'featureType', 'type': 'str'}, - 'features': {'key': 'features', 'type': '[SupportedFeature]'}, - } - - def __init__( - self, - **kwargs - ): - super(FeatureValidationResponse, self).__init__(**kwargs) - self.object_type = 'FeatureValidationResponse' # type: str - self.feature_type = kwargs.get('feature_type', None) - self.features = kwargs.get('features', None) - - -class ImmediateCopyOption(CopyOption): - """Immediate copy Option. - - All required parameters must be populated in order to send to Azure. - - :param object_type: Required. Type of the specific object - used for deserializing.Constant - filled by server. - :type object_type: str - """ - - _validation = { - 'object_type': {'required': True}, - } - - _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ImmediateCopyOption, self).__init__(**kwargs) - self.object_type = 'ImmediateCopyOption' # type: str - - -class InnerError(msrest.serialization.Model): - """Inner Error. - - :param additional_info: Any Key value pairs that can be provided to the client for additional - verbose information. - :type additional_info: dict[str, str] - :param code: Unique code for this error. - :type code: str - :param embedded_inner_error: Child Inner Error, to allow Nesting. - :type embedded_inner_error: ~azure.mgmt.dataprotection.models.InnerError - """ - - _attribute_map = { - 'additional_info': {'key': 'additionalInfo', 'type': '{str}'}, - 'code': {'key': 'code', 'type': 'str'}, - 'embedded_inner_error': {'key': 'embeddedInnerError', 'type': 'InnerError'}, - } - - def __init__( - self, - **kwargs - ): - super(InnerError, self).__init__(**kwargs) - self.additional_info = kwargs.get('additional_info', None) - self.code = kwargs.get('code', None) - self.embedded_inner_error = kwargs.get('embedded_inner_error', None) - - -class ItemLevelRestoreCriteria(msrest.serialization.Model): - """Class to contain criteria for item level restore. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: RangeBasedItemLevelRestoreCriteria. - - All required parameters must be populated in order to send to Azure. - - :param object_type: Required. Type of the specific object - used for deserializing.Constant - filled by server. - :type object_type: str - """ - - _validation = { - 'object_type': {'required': True}, - } - - _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - } - - _subtype_map = { - 'object_type': {'RangeBasedItemLevelRestoreCriteria': 'RangeBasedItemLevelRestoreCriteria'} - } - - def __init__( - self, - **kwargs - ): - super(ItemLevelRestoreCriteria, self).__init__(**kwargs) - self.object_type = None # type: Optional[str] - - -class RestoreTargetInfoBase(msrest.serialization.Model): - """Base class common to RestoreTargetInfo and RestoreFilesTargetInfo. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: ItemLevelRestoreTargetInfo, RestoreFilesTargetInfo, RestoreTargetInfo. - - All required parameters must be populated in order to send to Azure. - - :param object_type: Required. Type of Datasource object, used to initialize the right inherited - type.Constant filled by server. - :type object_type: str - :param recovery_option: Required. Recovery Option. Possible values include: "FailIfExists". - :type recovery_option: str or ~azure.mgmt.dataprotection.models.RecoveryOption - :param restore_location: Target Restore region. - :type restore_location: str - """ - - _validation = { - 'object_type': {'required': True}, - 'recovery_option': {'required': True}, - } - - _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'recovery_option': {'key': 'recoveryOption', 'type': 'str'}, - 'restore_location': {'key': 'restoreLocation', 'type': 'str'}, - } - - _subtype_map = { - 'object_type': {'ItemLevelRestoreTargetInfo': 'ItemLevelRestoreTargetInfo', 'RestoreFilesTargetInfo': 'RestoreFilesTargetInfo', 'RestoreTargetInfo': 'RestoreTargetInfo'} - } - - def __init__( - self, - **kwargs - ): - super(RestoreTargetInfoBase, self).__init__(**kwargs) - self.object_type = None # type: Optional[str] - self.recovery_option = kwargs['recovery_option'] - self.restore_location = kwargs.get('restore_location', None) - - -class ItemLevelRestoreTargetInfo(RestoreTargetInfoBase): - """Restore target info for Item level restore operation. - - All required parameters must be populated in order to send to Azure. - - :param object_type: Required. Type of Datasource object, used to initialize the right inherited - type.Constant filled by server. - :type object_type: str - :param recovery_option: Required. Recovery Option. Possible values include: "FailIfExists". - :type recovery_option: str or ~azure.mgmt.dataprotection.models.RecoveryOption - :param restore_location: Target Restore region. - :type restore_location: str - :param restore_criteria: Required. Restore Criteria. - :type restore_criteria: list[~azure.mgmt.dataprotection.models.ItemLevelRestoreCriteria] - :param datasource_info: Required. Information of target DS. - :type datasource_info: ~azure.mgmt.dataprotection.models.Datasource - :param datasource_set_info: Information of target DS Set. - :type datasource_set_info: ~azure.mgmt.dataprotection.models.DatasourceSet - :param datasource_auth_credentials: Credentials to use to authenticate with data source - provider. - :type datasource_auth_credentials: ~azure.mgmt.dataprotection.models.AuthCredentials - """ - - _validation = { - 'object_type': {'required': True}, - 'recovery_option': {'required': True}, - 'restore_criteria': {'required': True}, - 'datasource_info': {'required': True}, - } - - _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'recovery_option': {'key': 'recoveryOption', 'type': 'str'}, - 'restore_location': {'key': 'restoreLocation', 'type': 'str'}, - 'restore_criteria': {'key': 'restoreCriteria', 'type': '[ItemLevelRestoreCriteria]'}, - 'datasource_info': {'key': 'datasourceInfo', 'type': 'Datasource'}, - 'datasource_set_info': {'key': 'datasourceSetInfo', 'type': 'DatasourceSet'}, - 'datasource_auth_credentials': {'key': 'datasourceAuthCredentials', 'type': 'AuthCredentials'}, - } - - def __init__( - self, - **kwargs - ): - super(ItemLevelRestoreTargetInfo, self).__init__(**kwargs) - self.object_type = 'ItemLevelRestoreTargetInfo' # type: str - self.restore_criteria = kwargs['restore_criteria'] - self.datasource_info = kwargs['datasource_info'] - self.datasource_set_info = kwargs.get('datasource_set_info', None) - self.datasource_auth_credentials = kwargs.get('datasource_auth_credentials', None) - - -class JobExtendedInfo(msrest.serialization.Model): - """Extended Information about the job. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param additional_details: Job's Additional Details. - :type additional_details: dict[str, str] - :ivar backup_instance_state: State of the Backup Instance. - :vartype backup_instance_state: str - :ivar data_transferred_in_bytes: Number of bytes transferred. - :vartype data_transferred_in_bytes: float - :ivar recovery_destination: Destination where restore is done. - :vartype recovery_destination: str - :ivar source_recover_point: Details of the Source Recovery Point. - :vartype source_recover_point: ~azure.mgmt.dataprotection.models.RestoreJobRecoveryPointDetails - :ivar sub_tasks: List of Sub Tasks of the job. - :vartype sub_tasks: list[~azure.mgmt.dataprotection.models.JobSubTask] - :ivar target_recover_point: Details of the Target Recovery Point. - :vartype target_recover_point: ~azure.mgmt.dataprotection.models.RestoreJobRecoveryPointDetails - """ - - _validation = { - 'backup_instance_state': {'readonly': True}, - 'data_transferred_in_bytes': {'readonly': True}, - 'recovery_destination': {'readonly': True}, - 'source_recover_point': {'readonly': True}, - 'sub_tasks': {'readonly': True}, - 'target_recover_point': {'readonly': True}, - } - - _attribute_map = { - 'additional_details': {'key': 'additionalDetails', 'type': '{str}'}, - 'backup_instance_state': {'key': 'backupInstanceState', 'type': 'str'}, - 'data_transferred_in_bytes': {'key': 'dataTransferredInBytes', 'type': 'float'}, - 'recovery_destination': {'key': 'recoveryDestination', 'type': 'str'}, - 'source_recover_point': {'key': 'sourceRecoverPoint', 'type': 'RestoreJobRecoveryPointDetails'}, - 'sub_tasks': {'key': 'subTasks', 'type': '[JobSubTask]'}, - 'target_recover_point': {'key': 'targetRecoverPoint', 'type': 'RestoreJobRecoveryPointDetails'}, - } - - def __init__( - self, - **kwargs - ): - super(JobExtendedInfo, self).__init__(**kwargs) - self.additional_details = kwargs.get('additional_details', None) - self.backup_instance_state = None - self.data_transferred_in_bytes = None - self.recovery_destination = None - self.source_recover_point = None - self.sub_tasks = None - self.target_recover_point = None - - -class JobSubTask(msrest.serialization.Model): - """Details of Job's Sub Task. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param additional_details: Additional details of Sub Tasks. - :type additional_details: dict[str, str] - :param task_id: Required. Task Id of the Sub Task. - :type task_id: int - :param task_name: Required. Name of the Sub Task. - :type task_name: str - :ivar task_progress: Progress of the Sub Task. - :vartype task_progress: str - :param task_status: Required. Status of the Sub Task. - :type task_status: str - """ - - _validation = { - 'task_id': {'required': True}, - 'task_name': {'required': True}, - 'task_progress': {'readonly': True}, - 'task_status': {'required': True}, - } - - _attribute_map = { - 'additional_details': {'key': 'additionalDetails', 'type': '{str}'}, - 'task_id': {'key': 'taskId', 'type': 'int'}, - 'task_name': {'key': 'taskName', 'type': 'str'}, - 'task_progress': {'key': 'taskProgress', 'type': 'str'}, - 'task_status': {'key': 'taskStatus', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(JobSubTask, self).__init__(**kwargs) - self.additional_details = kwargs.get('additional_details', None) - self.task_id = kwargs['task_id'] - self.task_name = kwargs['task_name'] - self.task_progress = None - self.task_status = kwargs['task_status'] - - -class OperationExtendedInfo(msrest.serialization.Model): - """Operation Extended Info. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: OperationJobExtendedInfo. - - All required parameters must be populated in order to send to Azure. - - :param object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. - :type object_type: str - """ - - _validation = { - 'object_type': {'required': True}, - } - - _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - } - - _subtype_map = { - 'object_type': {'OperationJobExtendedInfo': 'OperationJobExtendedInfo'} - } - - def __init__( - self, - **kwargs - ): - super(OperationExtendedInfo, self).__init__(**kwargs) - self.object_type = None # type: Optional[str] - - -class OperationJobExtendedInfo(OperationExtendedInfo): - """Operation Job Extended Info. - - All required parameters must be populated in order to send to Azure. - - :param object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. - :type object_type: str - :param job_id: Arm Id of the job created for this operation. - :type job_id: str - """ - - _validation = { - 'object_type': {'required': True}, - } - - _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'job_id': {'key': 'jobId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationJobExtendedInfo, self).__init__(**kwargs) - self.object_type = 'OperationJobExtendedInfo' # type: str - self.job_id = kwargs.get('job_id', None) - - -class OperationResource(msrest.serialization.Model): - """Operation Resource. - - :param end_time: End time of the operation. - :type end_time: ~datetime.datetime - :param error: Required if status == failed or status == canceled. This is the OData v4 error - format, used by the RPC and will go into the v2.2 Azure REST API guidelines. - The full set of optional properties (e.g. inner errors / details) can be found in the "Error - Response" section. - :type error: ~azure.mgmt.dataprotection.models.Error - :param id: It should match what is used to GET the operation result. - :type id: str - :param name: It must match the last segment of the "id" field, and will typically be a GUID / - system generated value. - :type name: str - :param properties: End time of the operation. - :type properties: ~azure.mgmt.dataprotection.models.OperationExtendedInfo - :param start_time: Start time of the operation. - :type start_time: ~datetime.datetime - :param status: - :type status: str - """ - - _attribute_map = { - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'error': {'key': 'error', 'type': 'Error'}, - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'OperationExtendedInfo'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationResource, self).__init__(**kwargs) - self.end_time = kwargs.get('end_time', None) - self.error = kwargs.get('error', None) - self.id = kwargs.get('id', None) - self.name = kwargs.get('name', None) - self.properties = kwargs.get('properties', None) - self.start_time = kwargs.get('start_time', None) - self.status = kwargs.get('status', None) - - -class PatchResourceRequestInput(msrest.serialization.Model): - """Patch Request content for Microsoft.DataProtection resources. - - :param identity: Input Managed Identity Details. - :type identity: ~azure.mgmt.dataprotection.models.DppIdentityDetails - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - """ - - _attribute_map = { - 'identity': {'key': 'identity', 'type': 'DppIdentityDetails'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(PatchResourceRequestInput, self).__init__(**kwargs) - self.identity = kwargs.get('identity', None) - self.tags = kwargs.get('tags', None) - - -class PolicyInfo(msrest.serialization.Model): - """Policy Info in backupInstance. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param policy_id: Required. - :type policy_id: str - :ivar policy_version: - :vartype policy_version: str - :param policy_parameters: Policy parameters for the backup instance. - :type policy_parameters: ~azure.mgmt.dataprotection.models.PolicyParameters - """ - - _validation = { - 'policy_id': {'required': True}, - 'policy_version': {'readonly': True}, - } - - _attribute_map = { - 'policy_id': {'key': 'policyId', 'type': 'str'}, - 'policy_version': {'key': 'policyVersion', 'type': 'str'}, - 'policy_parameters': {'key': 'policyParameters', 'type': 'PolicyParameters'}, - } - - def __init__( - self, - **kwargs - ): - super(PolicyInfo, self).__init__(**kwargs) - self.policy_id = kwargs['policy_id'] - self.policy_version = None - self.policy_parameters = kwargs.get('policy_parameters', None) - - -class PolicyParameters(msrest.serialization.Model): - """Parameters in Policy. - - :param data_store_parameters_list: Gets or sets the DataStore Parameters. - :type data_store_parameters_list: list[~azure.mgmt.dataprotection.models.DataStoreParameters] - """ - - _attribute_map = { - 'data_store_parameters_list': {'key': 'dataStoreParametersList', 'type': '[DataStoreParameters]'}, - } - - def __init__( - self, - **kwargs - ): - super(PolicyParameters, self).__init__(**kwargs) - self.data_store_parameters_list = kwargs.get('data_store_parameters_list', None) - - -class ProtectionStatusDetails(msrest.serialization.Model): - """Protection status details. - - :param error_details: Specifies the protection status error of the resource. - :type error_details: ~azure.mgmt.dataprotection.models.UserFacingError - :param status: Specifies the protection status of the resource. Possible values include: - "ConfiguringProtection", "ConfiguringProtectionFailed", "ProtectionConfigured", - "ProtectionStopped", "SoftDeleted", "SoftDeleting". - :type status: str or ~azure.mgmt.dataprotection.models.Status - """ - - _attribute_map = { - 'error_details': {'key': 'errorDetails', 'type': 'UserFacingError'}, - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProtectionStatusDetails, self).__init__(**kwargs) - self.error_details = kwargs.get('error_details', None) - self.status = kwargs.get('status', None) - - -class RangeBasedItemLevelRestoreCriteria(ItemLevelRestoreCriteria): - """Item Level target info for restore operation. - - All required parameters must be populated in order to send to Azure. - - :param object_type: Required. Type of the specific object - used for deserializing.Constant - filled by server. - :type object_type: str - :param min_matching_value: minimum value for range prefix match. - :type min_matching_value: str - :param max_matching_value: maximum value for range prefix match. - :type max_matching_value: str - """ - - _validation = { - 'object_type': {'required': True}, - } - - _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'min_matching_value': {'key': 'minMatchingValue', 'type': 'str'}, - 'max_matching_value': {'key': 'maxMatchingValue', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RangeBasedItemLevelRestoreCriteria, self).__init__(**kwargs) - self.object_type = 'RangeBasedItemLevelRestoreCriteria' # type: str - self.min_matching_value = kwargs.get('min_matching_value', None) - self.max_matching_value = kwargs.get('max_matching_value', None) - - -class RecoveryPointDataStoreDetails(msrest.serialization.Model): - """RecoveryPoint datastore details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param creation_time: - :type creation_time: ~datetime.datetime - :param expiry_time: - :type expiry_time: ~datetime.datetime - :param id: - :type id: str - :param meta_data: - :type meta_data: str - :param state: - :type state: str - :param type: - :type type: str - :param visible: - :type visible: bool - :ivar rehydration_expiry_time: - :vartype rehydration_expiry_time: ~datetime.datetime - :ivar rehydration_status: Possible values include: "CREATE_IN_PROGRESS", "COMPLETED", - "DELETE_IN_PROGRESS", "DELETED", "FAILED". - :vartype rehydration_status: str or ~azure.mgmt.dataprotection.models.RehydrationStatus - """ - - _validation = { - 'rehydration_expiry_time': {'readonly': True}, - 'rehydration_status': {'readonly': True}, - } - - _attribute_map = { - 'creation_time': {'key': 'creationTime', 'type': 'iso-8601'}, - 'expiry_time': {'key': 'expiryTime', 'type': 'iso-8601'}, - 'id': {'key': 'id', 'type': 'str'}, - 'meta_data': {'key': 'metaData', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'visible': {'key': 'visible', 'type': 'bool'}, - 'rehydration_expiry_time': {'key': 'rehydrationExpiryTime', 'type': 'iso-8601'}, - 'rehydration_status': {'key': 'rehydrationStatus', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RecoveryPointDataStoreDetails, self).__init__(**kwargs) - self.creation_time = kwargs.get('creation_time', None) - self.expiry_time = kwargs.get('expiry_time', None) - self.id = kwargs.get('id', None) - self.meta_data = kwargs.get('meta_data', None) - self.state = kwargs.get('state', None) - self.type = kwargs.get('type', None) - self.visible = kwargs.get('visible', None) - self.rehydration_expiry_time = None - self.rehydration_status = None - - -class RecoveryPointsFilters(msrest.serialization.Model): - """RecoveryPointsFilters. - - :param restore_point_data_store_id: - :type restore_point_data_store_id: str - :param is_visible: - :type is_visible: bool - :param start_date: - :type start_date: str - :param end_date: - :type end_date: str - :param extended_info: - :type extended_info: bool - :param restore_point_state: - :type restore_point_state: str - """ - - _attribute_map = { - 'restore_point_data_store_id': {'key': 'restorePointDataStoreId', 'type': 'str'}, - 'is_visible': {'key': 'isVisible', 'type': 'bool'}, - 'start_date': {'key': 'startDate', 'type': 'str'}, - 'end_date': {'key': 'endDate', 'type': 'str'}, - 'extended_info': {'key': 'extendedInfo', 'type': 'bool'}, - 'restore_point_state': {'key': 'restorePointState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RecoveryPointsFilters, self).__init__(**kwargs) - self.restore_point_data_store_id = kwargs.get('restore_point_data_store_id', None) - self.is_visible = kwargs.get('is_visible', None) - self.start_date = kwargs.get('start_date', None) - self.end_date = kwargs.get('end_date', None) - self.extended_info = kwargs.get('extended_info', None) - self.restore_point_state = kwargs.get('restore_point_state', None) - - -class ResourceGuard(msrest.serialization.Model): - """ResourceGuard. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: Provisioning state of the BackupVault resource. Possible values - include: "Failed", "Provisioning", "Succeeded", "Unknown", "Updating". - :vartype provisioning_state: str or ~azure.mgmt.dataprotection.models.ProvisioningState - :ivar allow_auto_approvals: This flag indicates whether auto approval is allowed or not. - :vartype allow_auto_approvals: bool - :ivar resource_guard_operations: {readonly} List of operation details those are protected by - the ResourceGuard resource. - :vartype resource_guard_operations: - list[~azure.mgmt.dataprotection.models.ResourceGuardOperation] - :ivar vault_critical_operation_exclusion_list: List of critical operations which are not - protected by this resourceGuard. - :vartype vault_critical_operation_exclusion_list: list[str] - :ivar description: Description about the pre-req steps to perform all the critical operations. - :vartype description: str - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'allow_auto_approvals': {'readonly': True}, - 'resource_guard_operations': {'readonly': True}, - 'vault_critical_operation_exclusion_list': {'readonly': True}, - 'description': {'readonly': True}, - } - - _attribute_map = { - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'allow_auto_approvals': {'key': 'allowAutoApprovals', 'type': 'bool'}, - 'resource_guard_operations': {'key': 'resourceGuardOperations', 'type': '[ResourceGuardOperation]'}, - 'vault_critical_operation_exclusion_list': {'key': 'vaultCriticalOperationExclusionList', 'type': '[str]'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceGuard, self).__init__(**kwargs) - self.provisioning_state = None - self.allow_auto_approvals = None - self.resource_guard_operations = None - self.vault_critical_operation_exclusion_list = None - self.description = None - - -class ResourceGuardOperation(msrest.serialization.Model): - """This class contains all the details about a critical operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar vault_critical_operation: Name of the critical operation. - :vartype vault_critical_operation: str - :ivar request_resource_type: Type of resource request. - :vartype request_resource_type: str - """ - - _validation = { - 'vault_critical_operation': {'readonly': True}, - 'request_resource_type': {'readonly': True}, - } - - _attribute_map = { - 'vault_critical_operation': {'key': 'vaultCriticalOperation', 'type': 'str'}, - 'request_resource_type': {'key': 'requestResourceType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceGuardOperation, self).__init__(**kwargs) - self.vault_critical_operation = None - self.request_resource_type = None - - -class ResourceGuardResource(DppTrackedResource): - """ResourceGuardResource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param e_tag: Optional ETag. - :type e_tag: str - :ivar id: Resource Id represents the complete path to the resource. - :vartype id: str - :param identity: Input Managed Identity Details. - :type identity: ~azure.mgmt.dataprotection.models.DppIdentityDetails - :param location: Resource location. - :type location: str - :ivar name: Resource name associated with the resource. - :vartype name: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, 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 - :param properties: ResourceGuardResource properties. - :type properties: ~azure.mgmt.dataprotection.models.ResourceGuard - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'e_tag': {'key': 'eTag', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'DppIdentityDetails'}, - 'location': {'key': 'location', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'properties': {'key': 'properties', 'type': 'ResourceGuard'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceGuardResource, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class ResourceGuardResourceList(DppTrackedResourceList): - """List of ResourceGuard resources. - - :param next_link: The uri to fetch the next page of resources. Call ListNext() fetches next - page of resources. - :type next_link: str - :param value: List of resources. - :type value: list[~azure.mgmt.dataprotection.models.ResourceGuardResource] - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[ResourceGuardResource]'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceGuardResourceList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class ResourceMoveDetails(msrest.serialization.Model): - """ResourceMoveDetails will be returned in response to GetResource call from ARM. - - :param operation_id: CorrelationId of latest ResourceMove operation attempted. - :type operation_id: str - :param start_time_utc: Start time in UTC of latest ResourceMove operation attempted. ISO 8601 - format. - :type start_time_utc: str - :param completion_time_utc: Completion time in UTC of latest ResourceMove operation attempted. - ISO 8601 format. - :type completion_time_utc: str - :param source_resource_path: ARM resource path of source resource. - :type source_resource_path: str - :param target_resource_path: ARM resource path of target resource used in latest ResourceMove - operation. - :type target_resource_path: str - """ - - _attribute_map = { - 'operation_id': {'key': 'operationId', 'type': 'str'}, - 'start_time_utc': {'key': 'startTimeUtc', 'type': 'str'}, - 'completion_time_utc': {'key': 'completionTimeUtc', 'type': 'str'}, - 'source_resource_path': {'key': 'sourceResourcePath', 'type': 'str'}, - 'target_resource_path': {'key': 'targetResourcePath', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceMoveDetails, self).__init__(**kwargs) - self.operation_id = kwargs.get('operation_id', None) - self.start_time_utc = kwargs.get('start_time_utc', None) - self.completion_time_utc = kwargs.get('completion_time_utc', None) - self.source_resource_path = kwargs.get('source_resource_path', None) - self.target_resource_path = kwargs.get('target_resource_path', None) - - -class RestorableTimeRange(msrest.serialization.Model): - """RestorableTimeRange. - - All required parameters must be populated in order to send to Azure. - - :param start_time: Required. Start time for the available restore range. - :type start_time: str - :param end_time: Required. End time for the available restore range. - :type end_time: str - :param object_type: - :type object_type: str - """ - - _validation = { - 'start_time': {'required': True}, - 'end_time': {'required': True}, - } - - _attribute_map = { - 'start_time': {'key': 'startTime', 'type': 'str'}, - 'end_time': {'key': 'endTime', 'type': 'str'}, - 'object_type': {'key': 'objectType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RestorableTimeRange, self).__init__(**kwargs) - self.start_time = kwargs['start_time'] - self.end_time = kwargs['end_time'] - self.object_type = kwargs.get('object_type', None) - - -class RestoreFilesTargetInfo(RestoreTargetInfoBase): - """Class encapsulating restore as files target parameters. - - All required parameters must be populated in order to send to Azure. - - :param object_type: Required. Type of Datasource object, used to initialize the right inherited - type.Constant filled by server. - :type object_type: str - :param recovery_option: Required. Recovery Option. Possible values include: "FailIfExists". - :type recovery_option: str or ~azure.mgmt.dataprotection.models.RecoveryOption - :param restore_location: Target Restore region. - :type restore_location: str - :param target_details: Required. Destination of RestoreAsFiles operation, when destination is - not a datasource. - :type target_details: ~azure.mgmt.dataprotection.models.TargetDetails - """ - - _validation = { - 'object_type': {'required': True}, - 'recovery_option': {'required': True}, - 'target_details': {'required': True}, - } - - _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'recovery_option': {'key': 'recoveryOption', 'type': 'str'}, - 'restore_location': {'key': 'restoreLocation', 'type': 'str'}, - 'target_details': {'key': 'targetDetails', 'type': 'TargetDetails'}, - } - - def __init__( - self, - **kwargs - ): - super(RestoreFilesTargetInfo, self).__init__(**kwargs) - self.object_type = 'RestoreFilesTargetInfo' # type: str - self.target_details = kwargs['target_details'] - - -class RestoreJobRecoveryPointDetails(msrest.serialization.Model): - """RestoreJobRecoveryPointDetails. - - :param recovery_point_id: - :type recovery_point_id: str - :param recovery_point_time: - :type recovery_point_time: ~datetime.datetime - """ - - _attribute_map = { - 'recovery_point_id': {'key': 'recoveryPointID', 'type': 'str'}, - 'recovery_point_time': {'key': 'recoveryPointTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(RestoreJobRecoveryPointDetails, self).__init__(**kwargs) - self.recovery_point_id = kwargs.get('recovery_point_id', None) - self.recovery_point_time = kwargs.get('recovery_point_time', None) - - -class RestoreTargetInfo(RestoreTargetInfoBase): - """Class encapsulating restore target parameters. - - All required parameters must be populated in order to send to Azure. - - :param object_type: Required. Type of Datasource object, used to initialize the right inherited - type.Constant filled by server. - :type object_type: str - :param recovery_option: Required. Recovery Option. Possible values include: "FailIfExists". - :type recovery_option: str or ~azure.mgmt.dataprotection.models.RecoveryOption - :param restore_location: Target Restore region. - :type restore_location: str - :param datasource_info: Required. Information of target DS. - :type datasource_info: ~azure.mgmt.dataprotection.models.Datasource - :param datasource_set_info: Information of target DS Set. - :type datasource_set_info: ~azure.mgmt.dataprotection.models.DatasourceSet - :param datasource_auth_credentials: Credentials to use to authenticate with data source - provider. - :type datasource_auth_credentials: ~azure.mgmt.dataprotection.models.AuthCredentials - """ - - _validation = { - 'object_type': {'required': True}, - 'recovery_option': {'required': True}, - 'datasource_info': {'required': True}, - } - - _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'recovery_option': {'key': 'recoveryOption', 'type': 'str'}, - 'restore_location': {'key': 'restoreLocation', 'type': 'str'}, - 'datasource_info': {'key': 'datasourceInfo', 'type': 'Datasource'}, - 'datasource_set_info': {'key': 'datasourceSetInfo', 'type': 'DatasourceSet'}, - 'datasource_auth_credentials': {'key': 'datasourceAuthCredentials', 'type': 'AuthCredentials'}, - } - - def __init__( - self, - **kwargs - ): - super(RestoreTargetInfo, self).__init__(**kwargs) - self.object_type = 'RestoreTargetInfo' # type: str - self.datasource_info = kwargs['datasource_info'] - self.datasource_set_info = kwargs.get('datasource_set_info', None) - self.datasource_auth_credentials = kwargs.get('datasource_auth_credentials', None) - - -class RetentionTag(msrest.serialization.Model): - """Retention tag. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar e_tag: Retention Tag version. - :vartype e_tag: str - :ivar id: Retention Tag version. - :vartype id: str - :param tag_name: Required. Retention Tag Name to relate it to retention rule. - :type tag_name: str - """ - - _validation = { - 'e_tag': {'readonly': True}, - 'id': {'readonly': True}, - 'tag_name': {'required': True}, - } - - _attribute_map = { - 'e_tag': {'key': 'eTag', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'tag_name': {'key': 'tagName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RetentionTag, self).__init__(**kwargs) - self.e_tag = None - self.id = None - self.tag_name = kwargs['tag_name'] - - -class ScheduleBasedBackupCriteria(BackupCriteria): - """Schedule based backup criteria. - - All required parameters must be populated in order to send to Azure. - - :param object_type: Required. Type of the specific object - used for deserializing.Constant - filled by server. - :type object_type: str - :param absolute_criteria: it contains absolute values like "AllBackup" / "FirstOfDay" / - "FirstOfWeek" / "FirstOfMonth" - and should be part of AbsoluteMarker enum. - :type absolute_criteria: list[str or ~azure.mgmt.dataprotection.models.AbsoluteMarker] - :param days_of_month: This is day of the month from 1 to 28 other wise last of month. - :type days_of_month: list[~azure.mgmt.dataprotection.models.Day] - :param days_of_the_week: It should be Sunday/Monday/T..../Saturday. - :type days_of_the_week: list[str or ~azure.mgmt.dataprotection.models.DayOfWeek] - :param months_of_year: It should be January/February/....../December. - :type months_of_year: list[str or ~azure.mgmt.dataprotection.models.Month] - :param schedule_times: List of schedule times for backup. - :type schedule_times: list[~datetime.datetime] - :param weeks_of_the_month: It should be First/Second/Third/Fourth/Last. - :type weeks_of_the_month: list[str or ~azure.mgmt.dataprotection.models.WeekNumber] - """ - - _validation = { - 'object_type': {'required': True}, - } - - _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'absolute_criteria': {'key': 'absoluteCriteria', 'type': '[str]'}, - 'days_of_month': {'key': 'daysOfMonth', 'type': '[Day]'}, - 'days_of_the_week': {'key': 'daysOfTheWeek', 'type': '[str]'}, - 'months_of_year': {'key': 'monthsOfYear', 'type': '[str]'}, - 'schedule_times': {'key': 'scheduleTimes', 'type': '[iso-8601]'}, - 'weeks_of_the_month': {'key': 'weeksOfTheMonth', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(ScheduleBasedBackupCriteria, self).__init__(**kwargs) - self.object_type = 'ScheduleBasedBackupCriteria' # type: str - self.absolute_criteria = kwargs.get('absolute_criteria', None) - self.days_of_month = kwargs.get('days_of_month', None) - self.days_of_the_week = kwargs.get('days_of_the_week', None) - self.months_of_year = kwargs.get('months_of_year', None) - self.schedule_times = kwargs.get('schedule_times', None) - self.weeks_of_the_month = kwargs.get('weeks_of_the_month', None) - - -class ScheduleBasedTriggerContext(TriggerContext): - """Schedule based trigger context. - - All required parameters must be populated in order to send to Azure. - - :param object_type: Required. Type of the specific object - used for deserializing.Constant - filled by server. - :type object_type: str - :param schedule: Required. Schedule for this backup. - :type schedule: ~azure.mgmt.dataprotection.models.BackupSchedule - :param tagging_criteria: Required. List of tags that can be applicable for given schedule. - :type tagging_criteria: list[~azure.mgmt.dataprotection.models.TaggingCriteria] - """ - - _validation = { - 'object_type': {'required': True}, - 'schedule': {'required': True}, - 'tagging_criteria': {'required': True}, - } - - _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'schedule': {'key': 'schedule', 'type': 'BackupSchedule'}, - 'tagging_criteria': {'key': 'taggingCriteria', 'type': '[TaggingCriteria]'}, - } - - def __init__( - self, - **kwargs - ): - super(ScheduleBasedTriggerContext, self).__init__(**kwargs) - self.object_type = 'ScheduleBasedTriggerContext' # type: str - self.schedule = kwargs['schedule'] - self.tagging_criteria = kwargs['tagging_criteria'] - - -class SecretStoreBasedAuthCredentials(AuthCredentials): - """Secret store based authentication credentials. - - All required parameters must be populated in order to send to Azure. - - :param object_type: Required. Type of the specific object - used for deserializing.Constant - filled by server. - :type object_type: str - :param secret_store_resource: Secret store resource. - :type secret_store_resource: ~azure.mgmt.dataprotection.models.SecretStoreResource - """ - - _validation = { - 'object_type': {'required': True}, - } - - _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'secret_store_resource': {'key': 'secretStoreResource', 'type': 'SecretStoreResource'}, - } - - def __init__( - self, - **kwargs - ): - super(SecretStoreBasedAuthCredentials, self).__init__(**kwargs) - self.object_type = 'SecretStoreBasedAuthCredentials' # type: str - self.secret_store_resource = kwargs.get('secret_store_resource', None) - - -class SecretStoreResource(msrest.serialization.Model): - """Class representing a secret store resource. - - All required parameters must be populated in order to send to Azure. - - :param uri: Uri to get to the resource. - :type uri: str - :param secret_store_type: Required. Gets or sets the type of secret store. Possible values - include: "Invalid", "AzureKeyVault". - :type secret_store_type: str or ~azure.mgmt.dataprotection.models.SecretStoreType - """ - - _validation = { - 'secret_store_type': {'required': True}, - } - - _attribute_map = { - 'uri': {'key': 'uri', 'type': 'str'}, - 'secret_store_type': {'key': 'secretStoreType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SecretStoreResource, self).__init__(**kwargs) - self.uri = kwargs.get('uri', None) - self.secret_store_type = kwargs['secret_store_type'] - - -class SourceLifeCycle(msrest.serialization.Model): - """Source LifeCycle. - - All required parameters must be populated in order to send to Azure. - - :param delete_after: Required. Delete Option. - :type delete_after: ~azure.mgmt.dataprotection.models.DeleteOption - :param source_data_store: Required. DataStoreInfo base. - :type source_data_store: ~azure.mgmt.dataprotection.models.DataStoreInfoBase - :param target_data_store_copy_settings: - :type target_data_store_copy_settings: - list[~azure.mgmt.dataprotection.models.TargetCopySetting] - """ - - _validation = { - 'delete_after': {'required': True}, - 'source_data_store': {'required': True}, - } - - _attribute_map = { - 'delete_after': {'key': 'deleteAfter', 'type': 'DeleteOption'}, - 'source_data_store': {'key': 'sourceDataStore', 'type': 'DataStoreInfoBase'}, - 'target_data_store_copy_settings': {'key': 'targetDataStoreCopySettings', 'type': '[TargetCopySetting]'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceLifeCycle, self).__init__(**kwargs) - self.delete_after = kwargs['delete_after'] - self.source_data_store = kwargs['source_data_store'] - self.target_data_store_copy_settings = kwargs.get('target_data_store_copy_settings', None) - - -class StorageSetting(msrest.serialization.Model): - """Storage setting. - - :param datastore_type: Gets or sets the type of the datastore. Possible values include: - "ArchiveStore", "SnapshotStore", "VaultStore". - :type datastore_type: str or ~azure.mgmt.dataprotection.models.StorageSettingStoreTypes - :param type: Gets or sets the type. Possible values include: "GeoRedundant", - "LocallyRedundant". - :type type: str or ~azure.mgmt.dataprotection.models.StorageSettingTypes - """ - - _attribute_map = { - 'datastore_type': {'key': 'datastoreType', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageSetting, self).__init__(**kwargs) - self.datastore_type = kwargs.get('datastore_type', None) - self.type = kwargs.get('type', None) - - -class SupportedFeature(msrest.serialization.Model): - """Elements class for feature request. - - :param feature_name: support feature type. - :type feature_name: str - :param support_status: feature support status. Possible values include: "Invalid", - "NotSupported", "AlphaPreview", "PrivatePreview", "PublicPreview", "GenerallyAvailable". - :type support_status: str or ~azure.mgmt.dataprotection.models.FeatureSupportStatus - :param exposure_controlled_features: support feature type. - :type exposure_controlled_features: list[str] - """ - - _attribute_map = { - 'feature_name': {'key': 'featureName', 'type': 'str'}, - 'support_status': {'key': 'supportStatus', 'type': 'str'}, - 'exposure_controlled_features': {'key': 'exposureControlledFeatures', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(SupportedFeature, self).__init__(**kwargs) - self.feature_name = kwargs.get('feature_name', None) - self.support_status = kwargs.get('support_status', None) - self.exposure_controlled_features = kwargs.get('exposure_controlled_features', None) - - -class SystemData(msrest.serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure.mgmt.dataprotection.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or ~azure.mgmt.dataprotection.models.CreatedByType - :param last_modified_at: The type of identity that last modified the resource. - :type last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(SystemData, self).__init__(**kwargs) - self.created_by = kwargs.get('created_by', None) - self.created_by_type = kwargs.get('created_by_type', None) - self.created_at = kwargs.get('created_at', None) - self.last_modified_by = kwargs.get('last_modified_by', None) - self.last_modified_by_type = kwargs.get('last_modified_by_type', None) - self.last_modified_at = kwargs.get('last_modified_at', None) - - -class TaggingCriteria(msrest.serialization.Model): - """Tagging criteria. - - All required parameters must be populated in order to send to Azure. - - :param criteria: Criteria which decides whether the tag can be applied to a triggered backup. - :type criteria: list[~azure.mgmt.dataprotection.models.BackupCriteria] - :param is_default: Required. Specifies if tag is default. - :type is_default: bool - :param tagging_priority: Required. Retention Tag priority. - :type tagging_priority: long - :param tag_info: Required. Retention tag information. - :type tag_info: ~azure.mgmt.dataprotection.models.RetentionTag - """ - - _validation = { - 'is_default': {'required': True}, - 'tagging_priority': {'required': True}, - 'tag_info': {'required': True}, - } - - _attribute_map = { - 'criteria': {'key': 'criteria', 'type': '[BackupCriteria]'}, - 'is_default': {'key': 'isDefault', 'type': 'bool'}, - 'tagging_priority': {'key': 'taggingPriority', 'type': 'long'}, - 'tag_info': {'key': 'tagInfo', 'type': 'RetentionTag'}, - } - - def __init__( - self, - **kwargs - ): - super(TaggingCriteria, self).__init__(**kwargs) - self.criteria = kwargs.get('criteria', None) - self.is_default = kwargs['is_default'] - self.tagging_priority = kwargs['tagging_priority'] - self.tag_info = kwargs['tag_info'] - - -class TargetCopySetting(msrest.serialization.Model): - """Target copy settings. - - All required parameters must be populated in order to send to Azure. - - :param copy_after: Required. It can be CustomCopyOption or ImmediateCopyOption. - :type copy_after: ~azure.mgmt.dataprotection.models.CopyOption - :param data_store: Required. Info of target datastore. - :type data_store: ~azure.mgmt.dataprotection.models.DataStoreInfoBase - """ - - _validation = { - 'copy_after': {'required': True}, - 'data_store': {'required': True}, - } - - _attribute_map = { - 'copy_after': {'key': 'copyAfter', 'type': 'CopyOption'}, - 'data_store': {'key': 'dataStore', 'type': 'DataStoreInfoBase'}, - } - - def __init__( - self, - **kwargs - ): - super(TargetCopySetting, self).__init__(**kwargs) - self.copy_after = kwargs['copy_after'] - self.data_store = kwargs['data_store'] - - -class TargetDetails(msrest.serialization.Model): - """Class encapsulating target details, used where the destination is not a datasource. - - All required parameters must be populated in order to send to Azure. - - :param file_prefix: Required. Restore operation may create multiple files inside location - pointed by Url - Below will be the common prefix for all of them. - :type file_prefix: str - :param restore_target_location_type: Required. Denotes the target location where the data will - be restored, - string value for the enum - {Microsoft.Internal.AzureBackup.DataProtection.Common.Interface.RestoreTargetLocationType}. - Possible values include: "Invalid", "AzureBlobs", "AzureFiles". - :type restore_target_location_type: str or - ~azure.mgmt.dataprotection.models.RestoreTargetLocationType - :param url: Required. Url denoting the restore destination. It can point to container / file - share etc. - :type url: str - """ - - _validation = { - 'file_prefix': {'required': True}, - 'restore_target_location_type': {'required': True}, - 'url': {'required': True}, - } - - _attribute_map = { - 'file_prefix': {'key': 'filePrefix', 'type': 'str'}, - 'restore_target_location_type': {'key': 'restoreTargetLocationType', 'type': 'str'}, - 'url': {'key': 'url', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TargetDetails, self).__init__(**kwargs) - self.file_prefix = kwargs['file_prefix'] - self.restore_target_location_type = kwargs['restore_target_location_type'] - self.url = kwargs['url'] - - -class TriggerBackupRequest(msrest.serialization.Model): - """Trigger backup request. - - All required parameters must be populated in order to send to Azure. - - :param backup_rule_options: Required. Name for the Rule of the Policy which needs to be applied - for this backup. - :type backup_rule_options: ~azure.mgmt.dataprotection.models.AdHocBackupRuleOptions - """ - - _validation = { - 'backup_rule_options': {'required': True}, - } - - _attribute_map = { - 'backup_rule_options': {'key': 'backupRuleOptions', 'type': 'AdHocBackupRuleOptions'}, - } - - def __init__( - self, - **kwargs - ): - super(TriggerBackupRequest, self).__init__(**kwargs) - self.backup_rule_options = kwargs['backup_rule_options'] - - -class UserFacingError(msrest.serialization.Model): - """Error object used by layers that have access to localized content, and propagate that to user. - - :param code: Unique code for this error. - :type code: str - :param details: Additional related Errors. - :type details: list[~azure.mgmt.dataprotection.models.UserFacingError] - :param inner_error: Inner Error. - :type inner_error: ~azure.mgmt.dataprotection.models.InnerError - :param is_retryable: Whether the operation will be retryable or not. - :type is_retryable: bool - :param is_user_error: Whether the operation is due to a user error or service error. - :type is_user_error: bool - :param properties: Any key value pairs that can be injected inside error object. - :type properties: dict[str, str] - :param message: - :type message: str - :param recommended_action: RecommendedAction � localized. - :type recommended_action: list[str] - :param target: Target of the error. - :type target: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[UserFacingError]'}, - 'inner_error': {'key': 'innerError', 'type': 'InnerError'}, - 'is_retryable': {'key': 'isRetryable', 'type': 'bool'}, - 'is_user_error': {'key': 'isUserError', 'type': 'bool'}, - 'properties': {'key': 'properties', 'type': '{str}'}, - 'message': {'key': 'message', 'type': 'str'}, - 'recommended_action': {'key': 'recommendedAction', 'type': '[str]'}, - 'target': {'key': 'target', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UserFacingError, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.details = kwargs.get('details', None) - self.inner_error = kwargs.get('inner_error', None) - self.is_retryable = kwargs.get('is_retryable', None) - self.is_user_error = kwargs.get('is_user_error', None) - self.properties = kwargs.get('properties', None) - self.message = kwargs.get('message', None) - self.recommended_action = kwargs.get('recommended_action', None) - self.target = kwargs.get('target', None) - - -class ValidateForBackupRequest(msrest.serialization.Model): - """Validate for backup request. - - All required parameters must be populated in order to send to Azure. - - :param backup_instance: Required. Backup Instance. - :type backup_instance: ~azure.mgmt.dataprotection.models.BackupInstance - """ - - _validation = { - 'backup_instance': {'required': True}, - } - - _attribute_map = { - 'backup_instance': {'key': 'backupInstance', 'type': 'BackupInstance'}, - } - - def __init__( - self, - **kwargs - ): - super(ValidateForBackupRequest, self).__init__(**kwargs) - self.backup_instance = kwargs['backup_instance'] - - -class ValidateRestoreRequestObject(msrest.serialization.Model): - """Validate restore request object. - - All required parameters must be populated in order to send to Azure. - - :param restore_request_object: Required. Gets or sets the restore request object. - :type restore_request_object: ~azure.mgmt.dataprotection.models.AzureBackupRestoreRequest - """ - - _validation = { - 'restore_request_object': {'required': True}, - } - - _attribute_map = { - 'restore_request_object': {'key': 'restoreRequestObject', 'type': 'AzureBackupRestoreRequest'}, - } - - def __init__( - self, - **kwargs - ): - super(ValidateRestoreRequestObject, self).__init__(**kwargs) - self.restore_request_object = kwargs['restore_request_object'] 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 27867c12c61d..684a674ee0ec 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 @@ -22,11 +22,11 @@ class DeleteOption(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param duration: Required. Duration of deletion after given timespan. - :type duration: str - :param object_type: Required. Type of the specific object - used for deserializing.Constant + :ivar duration: Required. Duration of deletion after given timespan. + :vartype duration: str + :ivar object_type: Required. Type of the specific object - used for deserializing.Constant filled by server. - :type object_type: str + :vartype object_type: str """ _validation = { @@ -49,6 +49,10 @@ def __init__( duration: str, **kwargs ): + """ + :keyword duration: Required. Duration of deletion after given timespan. + :paramtype duration: str + """ super(DeleteOption, self).__init__(**kwargs) self.duration = duration self.object_type = None # type: Optional[str] @@ -59,11 +63,11 @@ class AbsoluteDeleteOption(DeleteOption): All required parameters must be populated in order to send to Azure. - :param duration: Required. Duration of deletion after given timespan. - :type duration: str - :param object_type: Required. Type of the specific object - used for deserializing.Constant + :ivar duration: Required. Duration of deletion after given timespan. + :vartype duration: str + :ivar object_type: Required. Type of the specific object - used for deserializing.Constant filled by server. - :type object_type: str + :vartype object_type: str """ _validation = { @@ -82,6 +86,10 @@ def __init__( duration: str, **kwargs ): + """ + :keyword duration: Required. Duration of deletion after given timespan. + :paramtype duration: str + """ super(AbsoluteDeleteOption, self).__init__(duration=duration, **kwargs) self.object_type = 'AbsoluteDeleteOption' # type: str @@ -91,10 +99,10 @@ class AdHocBackupRuleOptions(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param rule_name: Required. - :type rule_name: str - :param trigger_option: Required. Adhoc backup trigger option. - :type trigger_option: ~azure.mgmt.dataprotection.models.AdhocBackupTriggerOption + :ivar rule_name: Required. + :vartype rule_name: str + :ivar trigger_option: Required. Adhoc backup trigger option. + :vartype trigger_option: ~azure.mgmt.dataprotection.models.AdhocBackupTriggerOption """ _validation = { @@ -114,6 +122,12 @@ def __init__( trigger_option: "AdhocBackupTriggerOption", **kwargs ): + """ + :keyword rule_name: Required. + :paramtype rule_name: str + :keyword trigger_option: Required. Adhoc backup trigger option. + :paramtype trigger_option: ~azure.mgmt.dataprotection.models.AdhocBackupTriggerOption + """ super(AdHocBackupRuleOptions, self).__init__(**kwargs) self.rule_name = rule_name self.trigger_option = trigger_option @@ -122,8 +136,8 @@ def __init__( class AdhocBackupTriggerOption(msrest.serialization.Model): """Adhoc backup trigger option. - :param retention_tag_override: - :type retention_tag_override: str + :ivar retention_tag_override: + :vartype retention_tag_override: str """ _attribute_map = { @@ -136,6 +150,10 @@ def __init__( retention_tag_override: Optional[str] = None, **kwargs ): + """ + :keyword retention_tag_override: + :paramtype retention_tag_override: str + """ super(AdhocBackupTriggerOption, self).__init__(**kwargs) self.retention_tag_override = retention_tag_override @@ -143,8 +161,8 @@ def __init__( class AdhocBasedTaggingCriteria(msrest.serialization.Model): """Adhoc backup tagging criteria. - :param tag_info: Retention tag information. - :type tag_info: ~azure.mgmt.dataprotection.models.RetentionTag + :ivar tag_info: Retention tag information. + :vartype tag_info: ~azure.mgmt.dataprotection.models.RetentionTag """ _attribute_map = { @@ -157,6 +175,10 @@ def __init__( tag_info: Optional["RetentionTag"] = None, **kwargs ): + """ + :keyword tag_info: Retention tag information. + :paramtype tag_info: ~azure.mgmt.dataprotection.models.RetentionTag + """ super(AdhocBasedTaggingCriteria, self).__init__(**kwargs) self.tag_info = tag_info @@ -169,9 +191,9 @@ class TriggerContext(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param object_type: Required. Type of the specific object - used for deserializing.Constant + :ivar object_type: Required. Type of the specific object - used for deserializing.Constant filled by server. - :type object_type: str + :vartype object_type: str """ _validation = { @@ -190,6 +212,8 @@ def __init__( self, **kwargs ): + """ + """ super(TriggerContext, self).__init__(**kwargs) self.object_type = None # type: Optional[str] @@ -199,11 +223,11 @@ class AdhocBasedTriggerContext(TriggerContext): All required parameters must be populated in order to send to Azure. - :param object_type: Required. Type of the specific object - used for deserializing.Constant + :ivar object_type: Required. Type of the specific object - used for deserializing.Constant filled by server. - :type object_type: str - :param tagging_criteria: Required. Tagging Criteria containing retention tag for adhoc backup. - :type tagging_criteria: ~azure.mgmt.dataprotection.models.AdhocBasedTaggingCriteria + :vartype object_type: str + :ivar tagging_criteria: Required. Tagging Criteria containing retention tag for adhoc backup. + :vartype tagging_criteria: ~azure.mgmt.dataprotection.models.AdhocBasedTaggingCriteria """ _validation = { @@ -222,6 +246,11 @@ def __init__( tagging_criteria: "AdhocBasedTaggingCriteria", **kwargs ): + """ + :keyword tagging_criteria: Required. Tagging Criteria containing retention tag for adhoc + backup. + :paramtype tagging_criteria: ~azure.mgmt.dataprotection.models.AdhocBasedTaggingCriteria + """ super(AdhocBasedTriggerContext, self).__init__(**kwargs) self.object_type = 'AdhocBasedTriggerContext' # type: str self.tagging_criteria = tagging_criteria @@ -235,9 +264,9 @@ class AuthCredentials(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param object_type: Required. Type of the specific object - used for deserializing.Constant + :ivar object_type: Required. Type of the specific object - used for deserializing.Constant filled by server. - :type object_type: str + :vartype object_type: str """ _validation = { @@ -256,6 +285,8 @@ def __init__( self, **kwargs ): + """ + """ super(AuthCredentials, self).__init__(**kwargs) self.object_type = None # type: Optional[str] @@ -268,8 +299,8 @@ class AzureBackupRecoveryPoint(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param object_type: Required. Constant filled by server. - :type object_type: str + :ivar object_type: Required. Constant filled by server. + :vartype object_type: str """ _validation = { @@ -288,6 +319,8 @@ def __init__( self, **kwargs ): + """ + """ super(AzureBackupRecoveryPoint, self).__init__(**kwargs) self.object_type = None # type: Optional[str] @@ -297,27 +330,27 @@ class AzureBackupDiscreteRecoveryPoint(AzureBackupRecoveryPoint): All required parameters must be populated in order to send to Azure. - :param object_type: Required. Constant filled by server. - :type object_type: str - :param friendly_name: - :type friendly_name: str - :param recovery_point_data_stores_details: - :type recovery_point_data_stores_details: + :ivar object_type: Required. Constant filled by server. + :vartype object_type: str + :ivar friendly_name: + :vartype friendly_name: str + :ivar recovery_point_data_stores_details: + :vartype recovery_point_data_stores_details: list[~azure.mgmt.dataprotection.models.RecoveryPointDataStoreDetails] - :param recovery_point_time: Required. - :type recovery_point_time: ~datetime.datetime - :param policy_name: - :type policy_name: str - :param policy_version: - :type policy_version: str - :param recovery_point_id: - :type recovery_point_id: str - :param recovery_point_type: - :type recovery_point_type: str - :param retention_tag_name: - :type retention_tag_name: str - :param retention_tag_version: - :type retention_tag_version: str + :ivar recovery_point_time: Required. + :vartype recovery_point_time: ~datetime.datetime + :ivar policy_name: + :vartype policy_name: str + :ivar policy_version: + :vartype policy_version: str + :ivar recovery_point_id: + :vartype recovery_point_id: str + :ivar recovery_point_type: + :vartype recovery_point_type: str + :ivar retention_tag_name: + :vartype retention_tag_name: str + :ivar retention_tag_version: + :vartype retention_tag_version: str """ _validation = { @@ -352,6 +385,27 @@ def __init__( retention_tag_version: Optional[str] = None, **kwargs ): + """ + :keyword friendly_name: + :paramtype friendly_name: str + :keyword recovery_point_data_stores_details: + :paramtype recovery_point_data_stores_details: + list[~azure.mgmt.dataprotection.models.RecoveryPointDataStoreDetails] + :keyword recovery_point_time: Required. + :paramtype recovery_point_time: ~datetime.datetime + :keyword policy_name: + :paramtype policy_name: str + :keyword policy_version: + :paramtype policy_version: str + :keyword recovery_point_id: + :paramtype recovery_point_id: str + :keyword recovery_point_type: + :paramtype recovery_point_type: str + :keyword retention_tag_name: + :paramtype retention_tag_name: str + :keyword retention_tag_version: + :paramtype retention_tag_version: str + """ super(AzureBackupDiscreteRecoveryPoint, self).__init__(**kwargs) self.object_type = 'AzureBackupDiscreteRecoveryPoint' # type: str self.friendly_name = friendly_name @@ -370,14 +424,14 @@ class AzureBackupFindRestorableTimeRangesRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param source_data_store_type: Required. Gets or sets the type of the source data store. + :ivar source_data_store_type: Required. Gets or sets the type of the source data store. Possible values include: "OperationalStore", "VaultStore", "ArchiveStore". - :type source_data_store_type: str or + :vartype source_data_store_type: str or ~azure.mgmt.dataprotection.models.RestoreSourceDataStoreType - :param start_time: Start time for the List Restore Ranges request. ISO 8601 format. - :type start_time: str - :param end_time: End time for the List Restore Ranges request. ISO 8601 format. - :type end_time: str + :ivar start_time: Start time for the List Restore Ranges request. ISO 8601 format. + :vartype start_time: str + :ivar end_time: End time for the List Restore Ranges request. ISO 8601 format. + :vartype end_time: str """ _validation = { @@ -398,6 +452,16 @@ def __init__( end_time: Optional[str] = None, **kwargs ): + """ + :keyword source_data_store_type: Required. Gets or sets the type of the source data store. + Possible values include: "OperationalStore", "VaultStore", "ArchiveStore". + :paramtype source_data_store_type: str or + ~azure.mgmt.dataprotection.models.RestoreSourceDataStoreType + :keyword start_time: Start time for the List Restore Ranges request. ISO 8601 format. + :paramtype start_time: str + :keyword end_time: End time for the List Restore Ranges request. ISO 8601 format. + :paramtype end_time: str + """ super(AzureBackupFindRestorableTimeRangesRequest, self).__init__(**kwargs) self.source_data_store_type = source_data_store_type self.start_time = start_time @@ -407,21 +471,21 @@ def __init__( class DppWorkerRequest(msrest.serialization.Model): """DppWorkerRequest. - :param subscription_id: - :type subscription_id: str - :param uri: - :type uri: str - :param headers: Dictionary of + :ivar subscription_id: + :vartype subscription_id: str + :ivar uri: + :vartype uri: str + :ivar headers: Dictionary of . - :type headers: dict[str, list[str]] - :param supported_group_versions: - :type supported_group_versions: list[str] - :param culture_info: - :type culture_info: str - :param parameters: Dictionary of :code:``. - :type parameters: dict[str, str] - :param http_method: - :type http_method: str + :vartype headers: dict[str, list[str]] + :ivar supported_group_versions: + :vartype supported_group_versions: list[str] + :ivar culture_info: + :vartype culture_info: str + :ivar parameters: Dictionary of :code:``. + :vartype parameters: dict[str, str] + :ivar http_method: + :vartype http_method: str """ _attribute_map = { @@ -446,6 +510,23 @@ def __init__( http_method: Optional[str] = None, **kwargs ): + """ + :keyword subscription_id: + :paramtype subscription_id: str + :keyword uri: + :paramtype uri: str + :keyword headers: Dictionary of + . + :paramtype headers: dict[str, list[str]] + :keyword supported_group_versions: + :paramtype supported_group_versions: list[str] + :keyword culture_info: + :paramtype culture_info: str + :keyword parameters: Dictionary of :code:``. + :paramtype parameters: dict[str, str] + :keyword http_method: + :paramtype http_method: str + """ super(DppWorkerRequest, self).__init__(**kwargs) self.subscription_id = subscription_id self.uri = uri @@ -459,23 +540,23 @@ def __init__( class AzureBackupFindRestorableTimeRangesRequestResource(DppWorkerRequest): """List Restore Ranges Request. - :param subscription_id: - :type subscription_id: str - :param uri: - :type uri: str - :param headers: Dictionary of + :ivar subscription_id: + :vartype subscription_id: str + :ivar uri: + :vartype uri: str + :ivar headers: Dictionary of . - :type headers: dict[str, list[str]] - :param supported_group_versions: - :type supported_group_versions: list[str] - :param culture_info: - :type culture_info: str - :param parameters: Dictionary of :code:``. - :type parameters: dict[str, str] - :param http_method: - :type http_method: str - :param content: AzureBackupFindRestorableTimeRangesRequestResource content. - :type content: ~azure.mgmt.dataprotection.models.AzureBackupFindRestorableTimeRangesRequest + :vartype headers: dict[str, list[str]] + :ivar supported_group_versions: + :vartype supported_group_versions: list[str] + :ivar culture_info: + :vartype culture_info: str + :ivar parameters: Dictionary of :code:``. + :vartype parameters: dict[str, str] + :ivar http_method: + :vartype http_method: str + :ivar content: AzureBackupFindRestorableTimeRangesRequestResource content. + :vartype content: ~azure.mgmt.dataprotection.models.AzureBackupFindRestorableTimeRangesRequest """ _attribute_map = { @@ -502,6 +583,26 @@ def __init__( content: Optional["AzureBackupFindRestorableTimeRangesRequest"] = None, **kwargs ): + """ + :keyword subscription_id: + :paramtype subscription_id: str + :keyword uri: + :paramtype uri: str + :keyword headers: Dictionary of + . + :paramtype headers: dict[str, list[str]] + :keyword supported_group_versions: + :paramtype supported_group_versions: list[str] + :keyword culture_info: + :paramtype culture_info: str + :keyword parameters: Dictionary of :code:``. + :paramtype parameters: dict[str, str] + :keyword http_method: + :paramtype http_method: str + :keyword content: AzureBackupFindRestorableTimeRangesRequestResource content. + :paramtype content: + ~azure.mgmt.dataprotection.models.AzureBackupFindRestorableTimeRangesRequest + """ super(AzureBackupFindRestorableTimeRangesRequestResource, self).__init__(subscription_id=subscription_id, uri=uri, headers=headers, supported_group_versions=supported_group_versions, culture_info=culture_info, parameters=parameters, http_method=http_method, **kwargs) self.content = content @@ -509,10 +610,10 @@ def __init__( class AzureBackupFindRestorableTimeRangesResponse(msrest.serialization.Model): """List Restore Ranges Response. - :param restorable_time_ranges: Returns the Restore Ranges available on the Backup Instance. - :type restorable_time_ranges: list[~azure.mgmt.dataprotection.models.RestorableTimeRange] - :param object_type: - :type object_type: str + :ivar restorable_time_ranges: Returns the Restore Ranges available on the Backup Instance. + :vartype restorable_time_ranges: list[~azure.mgmt.dataprotection.models.RestorableTimeRange] + :ivar object_type: + :vartype object_type: str """ _attribute_map = { @@ -527,6 +628,12 @@ def __init__( object_type: Optional[str] = None, **kwargs ): + """ + :keyword restorable_time_ranges: Returns the Restore Ranges available on the Backup Instance. + :paramtype restorable_time_ranges: list[~azure.mgmt.dataprotection.models.RestorableTimeRange] + :keyword object_type: + :paramtype object_type: str + """ super(AzureBackupFindRestorableTimeRangesResponse, self).__init__(**kwargs) self.restorable_time_ranges = restorable_time_ranges self.object_type = object_type @@ -566,6 +673,8 @@ def __init__( self, **kwargs ): + """ + """ super(DppResource, self).__init__(**kwargs) self.id = None self.name = None @@ -587,8 +696,9 @@ class AzureBackupFindRestorableTimeRangesResponseResource(DppResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.dataprotection.models.SystemData - :param properties: AzureBackupFindRestorableTimeRangesResponseResource properties. - :type properties: ~azure.mgmt.dataprotection.models.AzureBackupFindRestorableTimeRangesResponse + :ivar properties: AzureBackupFindRestorableTimeRangesResponseResource properties. + :vartype properties: + ~azure.mgmt.dataprotection.models.AzureBackupFindRestorableTimeRangesResponse """ _validation = { @@ -612,6 +722,11 @@ def __init__( properties: Optional["AzureBackupFindRestorableTimeRangesResponse"] = None, **kwargs ): + """ + :keyword properties: AzureBackupFindRestorableTimeRangesResponseResource properties. + :paramtype properties: + ~azure.mgmt.dataprotection.models.AzureBackupFindRestorableTimeRangesResponse + """ super(AzureBackupFindRestorableTimeRangesResponseResource, self).__init__(**kwargs) self.properties = properties @@ -623,71 +738,71 @@ class AzureBackupJob(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param activity_id: Required. Job Activity Id. - :type activity_id: str - :param backup_instance_friendly_name: Required. Name of the Backup Instance. - :type backup_instance_friendly_name: str + :ivar activity_id: Required. Job Activity Id. + :vartype activity_id: str + :ivar backup_instance_friendly_name: Required. Name of the Backup Instance. + :vartype backup_instance_friendly_name: str :ivar backup_instance_id: ARM ID of the Backup Instance. :vartype backup_instance_id: str - :param data_source_id: Required. ARM ID of the DataSource. - :type data_source_id: str - :param data_source_location: Required. Location of the DataSource. - :type data_source_location: str - :param data_source_name: Required. User Friendly Name of the DataSource. - :type data_source_name: str - :param data_source_set_name: Data Source Set Name of the DataSource. - :type data_source_set_name: str - :param data_source_type: Required. Type of DataSource. - :type data_source_type: str - :param duration: Total run time of the job. ISO 8601 format. - :type duration: str + :ivar data_source_id: Required. ARM ID of the DataSource. + :vartype data_source_id: str + :ivar data_source_location: Required. Location of the DataSource. + :vartype data_source_location: str + :ivar data_source_name: Required. User Friendly Name of the DataSource. + :vartype data_source_name: str + :ivar data_source_set_name: Data Source Set Name of the DataSource. + :vartype data_source_set_name: str + :ivar data_source_type: Required. Type of DataSource. + :vartype data_source_type: str + :ivar duration: Total run time of the job. ISO 8601 format. + :vartype duration: str :ivar end_time: EndTime of the job(in UTC). :vartype end_time: ~datetime.datetime :ivar error_details: A List, detailing the errors related to the job. :vartype error_details: list[~azure.mgmt.dataprotection.models.UserFacingError] :ivar extended_info: Extended Information about the job. :vartype extended_info: ~azure.mgmt.dataprotection.models.JobExtendedInfo - :param is_user_triggered: Required. Indicated that whether the job is adhoc(true) or + :ivar is_user_triggered: Required. Indicated that whether the job is adhoc(true) or scheduled(false). - :type is_user_triggered: bool - :param operation: Required. It indicates the type of Job i.e. Backup:full/log/diff + :vartype is_user_triggered: bool + :ivar operation: Required. It indicates the type of Job i.e. Backup:full/log/diff ;Restore:ALR/OLR; Tiering:Backup/Archive ; Management:ConfigureProtection/UnConfigure. - :type operation: str - :param operation_category: Required. It indicates the type of Job i.e. + :vartype operation: str + :ivar operation_category: Required. It indicates the type of Job i.e. Backup/Restore/Tiering/Management. - :type operation_category: str + :vartype operation_category: str :ivar policy_id: ARM ID of the policy. :vartype policy_id: str :ivar policy_name: Name of the policy. :vartype policy_name: str - :param progress_enabled: Required. Indicated whether progress is enabled for the job. - :type progress_enabled: bool + :ivar progress_enabled: Required. Indicated whether progress is enabled for the job. + :vartype progress_enabled: bool :ivar progress_url: Url which contains job's progress. :vartype progress_url: str :ivar restore_type: It indicates the sub type of operation i.e. in case of Restore it can be ALR/OLR. :vartype restore_type: str - :param source_resource_group: Required. Resource Group Name of the Datasource. - :type source_resource_group: str - :param source_subscription_id: Required. SubscriptionId corresponding to the DataSource. - :type source_subscription_id: str - :param start_time: Required. StartTime of the job(in UTC). - :type start_time: ~datetime.datetime - :param status: Required. Status of the job like + :ivar source_resource_group: Required. Resource Group Name of the Datasource. + :vartype source_resource_group: str + :ivar source_subscription_id: Required. SubscriptionId corresponding to the DataSource. + :vartype source_subscription_id: str + :ivar start_time: Required. StartTime of the job(in UTC). + :vartype start_time: ~datetime.datetime + :ivar status: Required. Status of the job like InProgress/Success/Failed/Cancelled/SuccessWithWarning. - :type status: str - :param subscription_id: Required. Subscription Id of the corresponding backup vault. - :type subscription_id: str - :param supported_actions: Required. List of supported actions. - :type supported_actions: list[str] - :param vault_name: Required. Name of the vault. - :type vault_name: str - :param etag: - :type etag: str - :param source_data_store_name: - :type source_data_store_name: str - :param destination_data_store_name: - :type destination_data_store_name: str + :vartype status: str + :ivar subscription_id: Required. Subscription Id of the corresponding backup vault. + :vartype subscription_id: str + :ivar supported_actions: Required. List of supported actions. + :vartype supported_actions: list[str] + :ivar vault_name: Required. Name of the vault. + :vartype vault_name: str + :ivar etag: + :vartype etag: str + :ivar source_data_store_name: + :vartype source_data_store_name: str + :ivar destination_data_store_name: + :vartype destination_data_store_name: str """ _validation = { @@ -778,6 +893,56 @@ def __init__( destination_data_store_name: Optional[str] = None, **kwargs ): + """ + :keyword activity_id: Required. Job Activity Id. + :paramtype activity_id: str + :keyword backup_instance_friendly_name: Required. Name of the Backup Instance. + :paramtype backup_instance_friendly_name: str + :keyword data_source_id: Required. ARM ID of the DataSource. + :paramtype data_source_id: str + :keyword data_source_location: Required. Location of the DataSource. + :paramtype data_source_location: str + :keyword data_source_name: Required. User Friendly Name of the DataSource. + :paramtype data_source_name: str + :keyword data_source_set_name: Data Source Set Name of the DataSource. + :paramtype data_source_set_name: str + :keyword data_source_type: Required. Type of DataSource. + :paramtype data_source_type: str + :keyword duration: Total run time of the job. ISO 8601 format. + :paramtype duration: str + :keyword is_user_triggered: Required. Indicated that whether the job is adhoc(true) or + scheduled(false). + :paramtype is_user_triggered: bool + :keyword operation: Required. It indicates the type of Job i.e. Backup:full/log/diff + ;Restore:ALR/OLR; Tiering:Backup/Archive ; Management:ConfigureProtection/UnConfigure. + :paramtype operation: str + :keyword operation_category: Required. It indicates the type of Job i.e. + Backup/Restore/Tiering/Management. + :paramtype operation_category: str + :keyword progress_enabled: Required. Indicated whether progress is enabled for the job. + :paramtype progress_enabled: bool + :keyword source_resource_group: Required. Resource Group Name of the Datasource. + :paramtype source_resource_group: str + :keyword source_subscription_id: Required. SubscriptionId corresponding to the DataSource. + :paramtype source_subscription_id: str + :keyword start_time: Required. StartTime of the job(in UTC). + :paramtype start_time: ~datetime.datetime + :keyword status: Required. Status of the job like + InProgress/Success/Failed/Cancelled/SuccessWithWarning. + :paramtype status: str + :keyword subscription_id: Required. Subscription Id of the corresponding backup vault. + :paramtype subscription_id: str + :keyword supported_actions: Required. List of supported actions. + :paramtype supported_actions: list[str] + :keyword vault_name: Required. Name of the vault. + :paramtype vault_name: str + :keyword etag: + :paramtype etag: str + :keyword source_data_store_name: + :paramtype source_data_store_name: str + :keyword destination_data_store_name: + :paramtype destination_data_store_name: str + """ super(AzureBackupJob, self).__init__(**kwargs) self.activity_id = activity_id self.backup_instance_friendly_name = backup_instance_friendly_name @@ -825,8 +990,8 @@ class AzureBackupJobResource(DppResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.dataprotection.models.SystemData - :param properties: AzureBackupJobResource properties. - :type properties: ~azure.mgmt.dataprotection.models.AzureBackupJob + :ivar properties: AzureBackupJobResource properties. + :vartype properties: ~azure.mgmt.dataprotection.models.AzureBackupJob """ _validation = { @@ -850,6 +1015,10 @@ def __init__( properties: Optional["AzureBackupJob"] = None, **kwargs ): + """ + :keyword properties: AzureBackupJobResource properties. + :paramtype properties: ~azure.mgmt.dataprotection.models.AzureBackupJob + """ super(AzureBackupJobResource, self).__init__(**kwargs) self.properties = properties @@ -857,9 +1026,9 @@ def __init__( class DppResourceList(msrest.serialization.Model): """ListResource. - :param next_link: The uri to fetch the next page of resources. Call ListNext() fetches next - page of resources. - :type next_link: str + :ivar next_link: The uri to fetch the next page of resources. Call ListNext() fetches next page + of resources. + :vartype next_link: str """ _attribute_map = { @@ -872,6 +1041,11 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword next_link: The uri to fetch the next page of resources. Call ListNext() fetches next + page of resources. + :paramtype next_link: str + """ super(DppResourceList, self).__init__(**kwargs) self.next_link = next_link @@ -879,11 +1053,11 @@ def __init__( class AzureBackupJobResourceList(DppResourceList): """List of AzureBackup Job resources. - :param next_link: The uri to fetch the next page of resources. Call ListNext() fetches next - page of resources. - :type next_link: str - :param value: List of resources. - :type value: list[~azure.mgmt.dataprotection.models.AzureBackupJobResource] + :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.AzureBackupJobResource] """ _attribute_map = { @@ -898,6 +1072,13 @@ def __init__( value: Optional[List["AzureBackupJobResource"]] = None, **kwargs ): + """ + :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.AzureBackupJobResource] + """ super(AzureBackupJobResourceList, self).__init__(next_link=next_link, **kwargs) self.value = value @@ -910,9 +1091,9 @@ class BackupParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param object_type: Required. Type of the specific object - used for deserializing.Constant + :ivar object_type: Required. Type of the specific object - used for deserializing.Constant filled by server. - :type object_type: str + :vartype object_type: str """ _validation = { @@ -931,6 +1112,8 @@ def __init__( self, **kwargs ): + """ + """ super(BackupParameters, self).__init__(**kwargs) self.object_type = None # type: Optional[str] @@ -940,11 +1123,11 @@ class AzureBackupParams(BackupParameters): All required parameters must be populated in order to send to Azure. - :param object_type: Required. Type of the specific object - used for deserializing.Constant + :ivar object_type: Required. Type of the specific object - used for deserializing.Constant filled by server. - :type object_type: str - :param backup_type: Required. BackupType ; Full/Incremental etc. - :type backup_type: str + :vartype object_type: str + :ivar backup_type: Required. BackupType ; Full/Incremental etc. + :vartype backup_type: str """ _validation = { @@ -963,6 +1146,10 @@ def __init__( backup_type: str, **kwargs ): + """ + :keyword backup_type: Required. BackupType ; Full/Incremental etc. + :paramtype backup_type: str + """ super(AzureBackupParams, self).__init__(**kwargs) self.object_type = 'AzureBackupParams' # type: str self.backup_type = backup_type @@ -976,13 +1163,16 @@ class AzureBackupRestoreRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param object_type: Required. Constant filled by server. - :type object_type: str - :param restore_target_info: Required. Gets or sets the restore target information. - :type restore_target_info: ~azure.mgmt.dataprotection.models.RestoreTargetInfoBase - :param source_data_store_type: Required. Gets or sets the type of the source data store. + :ivar object_type: Required. Constant filled by server. + :vartype object_type: str + :ivar restore_target_info: Required. Gets or sets the restore target information. + :vartype restore_target_info: ~azure.mgmt.dataprotection.models.RestoreTargetInfoBase + :ivar source_data_store_type: Required. Gets or sets the type of the source data store. Possible values include: "ArchiveStore", "SnapshotStore", "VaultStore". - :type source_data_store_type: str or ~azure.mgmt.dataprotection.models.SourceDataStoreType + :vartype source_data_store_type: str or ~azure.mgmt.dataprotection.models.SourceDataStoreType + :ivar source_resource_id: Fully qualified Azure Resource Manager ID of the datasource which is + being recovered. + :vartype source_resource_id: str """ _validation = { @@ -995,6 +1185,7 @@ class AzureBackupRestoreRequest(msrest.serialization.Model): 'object_type': {'key': 'objectType', 'type': 'str'}, 'restore_target_info': {'key': 'restoreTargetInfo', 'type': 'RestoreTargetInfoBase'}, 'source_data_store_type': {'key': 'sourceDataStoreType', 'type': 'str'}, + 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, } _subtype_map = { @@ -1006,12 +1197,24 @@ def __init__( *, restore_target_info: "RestoreTargetInfoBase", source_data_store_type: Union[str, "SourceDataStoreType"], + source_resource_id: Optional[str] = None, **kwargs ): + """ + :keyword restore_target_info: Required. Gets or sets the restore target information. + :paramtype restore_target_info: ~azure.mgmt.dataprotection.models.RestoreTargetInfoBase + :keyword source_data_store_type: Required. Gets or sets the type of the source data store. + Possible values include: "ArchiveStore", "SnapshotStore", "VaultStore". + :paramtype source_data_store_type: str or ~azure.mgmt.dataprotection.models.SourceDataStoreType + :keyword source_resource_id: Fully qualified Azure Resource Manager ID of the datasource which + is being recovered. + :paramtype source_resource_id: str + """ super(AzureBackupRestoreRequest, self).__init__(**kwargs) self.object_type = None # type: Optional[str] self.restore_target_info = restore_target_info self.source_data_store_type = source_data_store_type + self.source_resource_id = source_resource_id class AzureBackupRecoveryPointBasedRestoreRequest(AzureBackupRestoreRequest): @@ -1022,15 +1225,18 @@ class AzureBackupRecoveryPointBasedRestoreRequest(AzureBackupRestoreRequest): All required parameters must be populated in order to send to Azure. - :param object_type: Required. Constant filled by server. - :type object_type: str - :param restore_target_info: Required. Gets or sets the restore target information. - :type restore_target_info: ~azure.mgmt.dataprotection.models.RestoreTargetInfoBase - :param source_data_store_type: Required. Gets or sets the type of the source data store. + :ivar object_type: Required. Constant filled by server. + :vartype object_type: str + :ivar restore_target_info: Required. Gets or sets the restore target information. + :vartype restore_target_info: ~azure.mgmt.dataprotection.models.RestoreTargetInfoBase + :ivar source_data_store_type: Required. Gets or sets the type of the source data store. Possible values include: "ArchiveStore", "SnapshotStore", "VaultStore". - :type source_data_store_type: str or ~azure.mgmt.dataprotection.models.SourceDataStoreType - :param recovery_point_id: Required. - :type recovery_point_id: str + :vartype source_data_store_type: str or ~azure.mgmt.dataprotection.models.SourceDataStoreType + :ivar source_resource_id: Fully qualified Azure Resource Manager ID of the datasource which is + being recovered. + :vartype source_resource_id: str + :ivar recovery_point_id: Required. + :vartype recovery_point_id: str """ _validation = { @@ -1044,6 +1250,7 @@ class AzureBackupRecoveryPointBasedRestoreRequest(AzureBackupRestoreRequest): 'object_type': {'key': 'objectType', 'type': 'str'}, 'restore_target_info': {'key': 'restoreTargetInfo', 'type': 'RestoreTargetInfoBase'}, 'source_data_store_type': {'key': 'sourceDataStoreType', 'type': 'str'}, + 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, 'recovery_point_id': {'key': 'recoveryPointId', 'type': 'str'}, } @@ -1057,9 +1264,22 @@ def __init__( restore_target_info: "RestoreTargetInfoBase", source_data_store_type: Union[str, "SourceDataStoreType"], recovery_point_id: str, + source_resource_id: Optional[str] = None, **kwargs ): - super(AzureBackupRecoveryPointBasedRestoreRequest, self).__init__(restore_target_info=restore_target_info, source_data_store_type=source_data_store_type, **kwargs) + """ + :keyword restore_target_info: Required. Gets or sets the restore target information. + :paramtype restore_target_info: ~azure.mgmt.dataprotection.models.RestoreTargetInfoBase + :keyword source_data_store_type: Required. Gets or sets the type of the source data store. + Possible values include: "ArchiveStore", "SnapshotStore", "VaultStore". + :paramtype source_data_store_type: str or ~azure.mgmt.dataprotection.models.SourceDataStoreType + :keyword source_resource_id: Fully qualified Azure Resource Manager ID of the datasource which + is being recovered. + :paramtype source_resource_id: str + :keyword recovery_point_id: Required. + :paramtype recovery_point_id: str + """ + super(AzureBackupRecoveryPointBasedRestoreRequest, self).__init__(restore_target_info=restore_target_info, source_data_store_type=source_data_store_type, source_resource_id=source_resource_id, **kwargs) self.object_type = 'AzureBackupRecoveryPointBasedRestoreRequest' # type: str self.recovery_point_id = recovery_point_id @@ -1078,8 +1298,8 @@ class AzureBackupRecoveryPointResource(DppResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.dataprotection.models.SystemData - :param properties: AzureBackupRecoveryPointResource properties. - :type properties: ~azure.mgmt.dataprotection.models.AzureBackupRecoveryPoint + :ivar properties: AzureBackupRecoveryPointResource properties. + :vartype properties: ~azure.mgmt.dataprotection.models.AzureBackupRecoveryPoint """ _validation = { @@ -1103,6 +1323,10 @@ def __init__( properties: Optional["AzureBackupRecoveryPoint"] = None, **kwargs ): + """ + :keyword properties: AzureBackupRecoveryPointResource properties. + :paramtype properties: ~azure.mgmt.dataprotection.models.AzureBackupRecoveryPoint + """ super(AzureBackupRecoveryPointResource, self).__init__(**kwargs) self.properties = properties @@ -1110,11 +1334,11 @@ def __init__( class AzureBackupRecoveryPointResourceList(DppResourceList): """Azure backup recoveryPoint resource list. - :param next_link: The uri to fetch the next page of resources. Call ListNext() fetches next - page of resources. - :type next_link: str - :param value: List of resources. - :type value: list[~azure.mgmt.dataprotection.models.AzureBackupRecoveryPointResource] + :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.AzureBackupRecoveryPointResource] """ _attribute_map = { @@ -1129,6 +1353,13 @@ def __init__( value: Optional[List["AzureBackupRecoveryPointResource"]] = None, **kwargs ): + """ + :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.AzureBackupRecoveryPointResource] + """ super(AzureBackupRecoveryPointResourceList, self).__init__(next_link=next_link, **kwargs) self.value = value @@ -1138,16 +1369,19 @@ class AzureBackupRecoveryTimeBasedRestoreRequest(AzureBackupRestoreRequest): All required parameters must be populated in order to send to Azure. - :param object_type: Required. Constant filled by server. - :type object_type: str - :param restore_target_info: Required. Gets or sets the restore target information. - :type restore_target_info: ~azure.mgmt.dataprotection.models.RestoreTargetInfoBase - :param source_data_store_type: Required. Gets or sets the type of the source data store. + :ivar object_type: Required. Constant filled by server. + :vartype object_type: str + :ivar restore_target_info: Required. Gets or sets the restore target information. + :vartype restore_target_info: ~azure.mgmt.dataprotection.models.RestoreTargetInfoBase + :ivar source_data_store_type: Required. Gets or sets the type of the source data store. Possible values include: "ArchiveStore", "SnapshotStore", "VaultStore". - :type source_data_store_type: str or ~azure.mgmt.dataprotection.models.SourceDataStoreType - :param recovery_point_time: Required. The recovery time in ISO 8601 format example - + :vartype source_data_store_type: str or ~azure.mgmt.dataprotection.models.SourceDataStoreType + :ivar source_resource_id: Fully qualified Azure Resource Manager ID of the datasource which is + being recovered. + :vartype source_resource_id: str + :ivar recovery_point_time: Required. The recovery time in ISO 8601 format example - 2020-08-14T17:30:00.0000000Z. - :type recovery_point_time: str + :vartype recovery_point_time: str """ _validation = { @@ -1161,6 +1395,7 @@ class AzureBackupRecoveryTimeBasedRestoreRequest(AzureBackupRestoreRequest): 'object_type': {'key': 'objectType', 'type': 'str'}, 'restore_target_info': {'key': 'restoreTargetInfo', 'type': 'RestoreTargetInfoBase'}, 'source_data_store_type': {'key': 'sourceDataStoreType', 'type': 'str'}, + 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, 'recovery_point_time': {'key': 'recoveryPointTime', 'type': 'str'}, } @@ -1170,9 +1405,23 @@ def __init__( restore_target_info: "RestoreTargetInfoBase", source_data_store_type: Union[str, "SourceDataStoreType"], recovery_point_time: str, + source_resource_id: Optional[str] = None, **kwargs ): - super(AzureBackupRecoveryTimeBasedRestoreRequest, self).__init__(restore_target_info=restore_target_info, source_data_store_type=source_data_store_type, **kwargs) + """ + :keyword restore_target_info: Required. Gets or sets the restore target information. + :paramtype restore_target_info: ~azure.mgmt.dataprotection.models.RestoreTargetInfoBase + :keyword source_data_store_type: Required. Gets or sets the type of the source data store. + Possible values include: "ArchiveStore", "SnapshotStore", "VaultStore". + :paramtype source_data_store_type: str or ~azure.mgmt.dataprotection.models.SourceDataStoreType + :keyword source_resource_id: Fully qualified Azure Resource Manager ID of the datasource which + is being recovered. + :paramtype source_resource_id: str + :keyword recovery_point_time: Required. The recovery time in ISO 8601 format example - + 2020-08-14T17:30:00.0000000Z. + :paramtype recovery_point_time: str + """ + super(AzureBackupRecoveryTimeBasedRestoreRequest, self).__init__(restore_target_info=restore_target_info, source_data_store_type=source_data_store_type, source_resource_id=source_resource_id, **kwargs) self.object_type = 'AzureBackupRecoveryTimeBasedRestoreRequest' # type: str self.recovery_point_time = recovery_point_time @@ -1182,14 +1431,14 @@ class AzureBackupRehydrationRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param recovery_point_id: Required. Id of the recovery point to be recovered. - :type recovery_point_id: str - :param rehydration_priority: Priority to be used for rehydration. Values High or Standard. + :ivar recovery_point_id: Required. Id of the recovery point to be recovered. + :vartype recovery_point_id: str + :ivar rehydration_priority: Priority to be used for rehydration. Values High or Standard. Possible values include: "Invalid", "High", "Standard". - :type rehydration_priority: str or ~azure.mgmt.dataprotection.models.RehydrationPriority - :param rehydration_retention_duration: Required. Retention duration in ISO 8601 format i.e P10D + :vartype rehydration_priority: str or ~azure.mgmt.dataprotection.models.RehydrationPriority + :ivar rehydration_retention_duration: Required. Retention duration in ISO 8601 format i.e P10D . - :type rehydration_retention_duration: str + :vartype rehydration_retention_duration: str """ _validation = { @@ -1211,6 +1460,16 @@ def __init__( rehydration_priority: Optional[Union[str, "RehydrationPriority"]] = None, **kwargs ): + """ + :keyword recovery_point_id: Required. Id of the recovery point to be recovered. + :paramtype recovery_point_id: str + :keyword rehydration_priority: Priority to be used for rehydration. Values High or Standard. + Possible values include: "Invalid", "High", "Standard". + :paramtype rehydration_priority: str or ~azure.mgmt.dataprotection.models.RehydrationPriority + :keyword rehydration_retention_duration: Required. Retention duration in ISO 8601 format i.e + P10D . + :paramtype rehydration_retention_duration: str + """ super(AzureBackupRehydrationRequest, self).__init__(**kwargs) self.recovery_point_id = recovery_point_id self.rehydration_priority = rehydration_priority @@ -1222,21 +1481,24 @@ class AzureBackupRestoreWithRehydrationRequest(AzureBackupRecoveryPointBasedRest All required parameters must be populated in order to send to Azure. - :param object_type: Required. Constant filled by server. - :type object_type: str - :param restore_target_info: Required. Gets or sets the restore target information. - :type restore_target_info: ~azure.mgmt.dataprotection.models.RestoreTargetInfoBase - :param source_data_store_type: Required. Gets or sets the type of the source data store. + :ivar object_type: Required. Constant filled by server. + :vartype object_type: str + :ivar restore_target_info: Required. Gets or sets the restore target information. + :vartype restore_target_info: ~azure.mgmt.dataprotection.models.RestoreTargetInfoBase + :ivar source_data_store_type: Required. Gets or sets the type of the source data store. Possible values include: "ArchiveStore", "SnapshotStore", "VaultStore". - :type source_data_store_type: str or ~azure.mgmt.dataprotection.models.SourceDataStoreType - :param recovery_point_id: Required. - :type recovery_point_id: str - :param rehydration_priority: Required. Priority to be used for rehydration. Values High or + :vartype source_data_store_type: str or ~azure.mgmt.dataprotection.models.SourceDataStoreType + :ivar source_resource_id: Fully qualified Azure Resource Manager ID of the datasource which is + being recovered. + :vartype source_resource_id: str + :ivar recovery_point_id: Required. + :vartype recovery_point_id: str + :ivar rehydration_priority: Required. Priority to be used for rehydration. Values High or Standard. Possible values include: "Invalid", "High", "Standard". - :type rehydration_priority: str or ~azure.mgmt.dataprotection.models.RehydrationPriority - :param rehydration_retention_duration: Required. Retention duration in ISO 8601 format i.e P10D + :vartype rehydration_priority: str or ~azure.mgmt.dataprotection.models.RehydrationPriority + :ivar rehydration_retention_duration: Required. Retention duration in ISO 8601 format i.e P10D . - :type rehydration_retention_duration: str + :vartype rehydration_retention_duration: str """ _validation = { @@ -1252,6 +1514,7 @@ class AzureBackupRestoreWithRehydrationRequest(AzureBackupRecoveryPointBasedRest 'object_type': {'key': 'objectType', 'type': 'str'}, 'restore_target_info': {'key': 'restoreTargetInfo', 'type': 'RestoreTargetInfoBase'}, 'source_data_store_type': {'key': 'sourceDataStoreType', 'type': 'str'}, + 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, 'recovery_point_id': {'key': 'recoveryPointId', 'type': 'str'}, 'rehydration_priority': {'key': 'rehydrationPriority', 'type': 'str'}, 'rehydration_retention_duration': {'key': 'rehydrationRetentionDuration', 'type': 'str'}, @@ -1265,9 +1528,28 @@ def __init__( recovery_point_id: str, rehydration_priority: Union[str, "RehydrationPriority"], rehydration_retention_duration: str, + source_resource_id: Optional[str] = None, **kwargs ): - super(AzureBackupRestoreWithRehydrationRequest, self).__init__(restore_target_info=restore_target_info, source_data_store_type=source_data_store_type, recovery_point_id=recovery_point_id, **kwargs) + """ + :keyword restore_target_info: Required. Gets or sets the restore target information. + :paramtype restore_target_info: ~azure.mgmt.dataprotection.models.RestoreTargetInfoBase + :keyword source_data_store_type: Required. Gets or sets the type of the source data store. + Possible values include: "ArchiveStore", "SnapshotStore", "VaultStore". + :paramtype source_data_store_type: str or ~azure.mgmt.dataprotection.models.SourceDataStoreType + :keyword source_resource_id: Fully qualified Azure Resource Manager ID of the datasource which + is being recovered. + :paramtype source_resource_id: str + :keyword recovery_point_id: Required. + :paramtype recovery_point_id: str + :keyword rehydration_priority: Required. Priority to be used for rehydration. Values High or + Standard. Possible values include: "Invalid", "High", "Standard". + :paramtype rehydration_priority: str or ~azure.mgmt.dataprotection.models.RehydrationPriority + :keyword rehydration_retention_duration: Required. Retention duration in ISO 8601 format i.e + P10D . + :paramtype rehydration_retention_duration: str + """ + super(AzureBackupRestoreWithRehydrationRequest, self).__init__(restore_target_info=restore_target_info, source_data_store_type=source_data_store_type, source_resource_id=source_resource_id, recovery_point_id=recovery_point_id, **kwargs) self.object_type = 'AzureBackupRestoreWithRehydrationRequest' # type: str self.rehydration_priority = rehydration_priority self.rehydration_retention_duration = rehydration_retention_duration @@ -1281,10 +1563,10 @@ class BasePolicyRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. - :type name: str - :param object_type: Required. Constant filled by server. - :type object_type: str + :ivar name: Required. + :vartype name: str + :ivar object_type: Required. Constant filled by server. + :vartype object_type: str """ _validation = { @@ -1307,6 +1589,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. + :paramtype name: str + """ super(BasePolicyRule, self).__init__(**kwargs) self.name = name self.object_type = None # type: Optional[str] @@ -1317,16 +1603,16 @@ class AzureBackupRule(BasePolicyRule): All required parameters must be populated in order to send to Azure. - :param name: Required. - :type name: str - :param object_type: Required. Constant filled by server. - :type object_type: str - :param backup_parameters: BackupParameters base. - :type backup_parameters: ~azure.mgmt.dataprotection.models.BackupParameters - :param data_store: Required. DataStoreInfo base. - :type data_store: ~azure.mgmt.dataprotection.models.DataStoreInfoBase - :param trigger: Required. Trigger context. - :type trigger: ~azure.mgmt.dataprotection.models.TriggerContext + :ivar name: Required. + :vartype name: str + :ivar object_type: Required. Constant filled by server. + :vartype object_type: str + :ivar backup_parameters: BackupParameters base. + :vartype backup_parameters: ~azure.mgmt.dataprotection.models.BackupParameters + :ivar data_store: Required. DataStoreInfo base. + :vartype data_store: ~azure.mgmt.dataprotection.models.DataStoreInfoBase + :ivar trigger: Required. Trigger context. + :vartype trigger: ~azure.mgmt.dataprotection.models.TriggerContext """ _validation = { @@ -1353,6 +1639,16 @@ def __init__( backup_parameters: Optional["BackupParameters"] = None, **kwargs ): + """ + :keyword name: Required. + :paramtype name: str + :keyword backup_parameters: BackupParameters base. + :paramtype backup_parameters: ~azure.mgmt.dataprotection.models.BackupParameters + :keyword data_store: Required. DataStoreInfo base. + :paramtype data_store: ~azure.mgmt.dataprotection.models.DataStoreInfoBase + :keyword trigger: Required. Trigger context. + :paramtype trigger: ~azure.mgmt.dataprotection.models.TriggerContext + """ super(AzureBackupRule, self).__init__(name=name, **kwargs) self.object_type = 'AzureBackupRule' # type: str self.backup_parameters = backup_parameters @@ -1360,6 +1656,31 @@ def __init__( self.trigger = trigger +class AzureMonitorAlertSettings(msrest.serialization.Model): + """Settings for Azure Monitor based alerts. + + :ivar alerts_for_all_job_failures: Possible values include: "Enabled", "Disabled". + :vartype alerts_for_all_job_failures: str or ~azure.mgmt.dataprotection.models.AlertsState + """ + + _attribute_map = { + 'alerts_for_all_job_failures': {'key': 'alertsForAllJobFailures', 'type': 'str'}, + } + + def __init__( + self, + *, + alerts_for_all_job_failures: Optional[Union[str, "AlertsState"]] = None, + **kwargs + ): + """ + :keyword alerts_for_all_job_failures: Possible values include: "Enabled", "Disabled". + :paramtype alerts_for_all_job_failures: str or ~azure.mgmt.dataprotection.models.AlertsState + """ + super(AzureMonitorAlertSettings, self).__init__(**kwargs) + self.alerts_for_all_job_failures = alerts_for_all_job_failures + + class DataStoreParameters(msrest.serialization.Model): """Parameters for DataStore. @@ -1368,12 +1689,12 @@ class DataStoreParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param object_type: Required. Type of the specific object - used for deserializing.Constant + :ivar object_type: Required. Type of the specific object - used for deserializing.Constant filled by server. - :type object_type: str - :param data_store_type: Required. type of datastore; Operational/Vault/Archive. Possible values + :vartype object_type: str + :ivar data_store_type: Required. type of datastore; Operational/Vault/Archive. Possible values include: "OperationalStore", "VaultStore", "ArchiveStore". - :type data_store_type: str or ~azure.mgmt.dataprotection.models.DataStoreTypes + :vartype data_store_type: str or ~azure.mgmt.dataprotection.models.DataStoreTypes """ _validation = { @@ -1396,6 +1717,11 @@ def __init__( data_store_type: Union[str, "DataStoreTypes"], **kwargs ): + """ + :keyword data_store_type: Required. type of datastore; Operational/Vault/Archive. Possible + values include: "OperationalStore", "VaultStore", "ArchiveStore". + :paramtype data_store_type: str or ~azure.mgmt.dataprotection.models.DataStoreTypes + """ super(DataStoreParameters, self).__init__(**kwargs) self.object_type = None # type: Optional[str] self.data_store_type = data_store_type @@ -1406,14 +1732,14 @@ class AzureOperationalStoreParameters(DataStoreParameters): All required parameters must be populated in order to send to Azure. - :param object_type: Required. Type of the specific object - used for deserializing.Constant + :ivar object_type: Required. Type of the specific object - used for deserializing.Constant filled by server. - :type object_type: str - :param data_store_type: Required. type of datastore; Operational/Vault/Archive. Possible values + :vartype object_type: str + :ivar data_store_type: Required. type of datastore; Operational/Vault/Archive. Possible values include: "OperationalStore", "VaultStore", "ArchiveStore". - :type data_store_type: str or ~azure.mgmt.dataprotection.models.DataStoreTypes - :param resource_group_id: Gets or sets the Snapshot Resource Group Uri. - :type resource_group_id: str + :vartype data_store_type: str or ~azure.mgmt.dataprotection.models.DataStoreTypes + :ivar resource_group_id: Gets or sets the Snapshot Resource Group Uri. + :vartype resource_group_id: str """ _validation = { @@ -1434,6 +1760,13 @@ def __init__( resource_group_id: Optional[str] = None, **kwargs ): + """ + :keyword data_store_type: Required. type of datastore; Operational/Vault/Archive. Possible + values include: "OperationalStore", "VaultStore", "ArchiveStore". + :paramtype data_store_type: str or ~azure.mgmt.dataprotection.models.DataStoreTypes + :keyword resource_group_id: Gets or sets the Snapshot Resource Group Uri. + :paramtype resource_group_id: str + """ super(AzureOperationalStoreParameters, self).__init__(data_store_type=data_store_type, **kwargs) self.object_type = 'AzureOperationalStoreParameters' # type: str self.resource_group_id = resource_group_id @@ -1444,14 +1777,14 @@ class AzureRetentionRule(BasePolicyRule): All required parameters must be populated in order to send to Azure. - :param name: Required. - :type name: str - :param object_type: Required. Constant filled by server. - :type object_type: str - :param is_default: - :type is_default: bool - :param lifecycles: Required. - :type lifecycles: list[~azure.mgmt.dataprotection.models.SourceLifeCycle] + :ivar name: Required. + :vartype name: str + :ivar object_type: Required. Constant filled by server. + :vartype object_type: str + :ivar is_default: + :vartype is_default: bool + :ivar lifecycles: Required. + :vartype lifecycles: list[~azure.mgmt.dataprotection.models.SourceLifeCycle] """ _validation = { @@ -1475,6 +1808,14 @@ def __init__( is_default: Optional[bool] = None, **kwargs ): + """ + :keyword name: Required. + :paramtype name: str + :keyword is_default: + :paramtype is_default: bool + :keyword lifecycles: Required. + :paramtype lifecycles: list[~azure.mgmt.dataprotection.models.SourceLifeCycle] + """ super(AzureRetentionRule, self).__init__(name=name, **kwargs) self.object_type = 'AzureRetentionRule' # type: str self.is_default = is_default @@ -1489,9 +1830,9 @@ class BackupCriteria(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param object_type: Required. Type of the specific object - used for deserializing.Constant + :ivar object_type: Required. Type of the specific object - used for deserializing.Constant filled by server. - :type object_type: str + :vartype object_type: str """ _validation = { @@ -1510,6 +1851,8 @@ def __init__( self, **kwargs ): + """ + """ super(BackupCriteria, self).__init__(**kwargs) self.object_type = None # type: Optional[str] @@ -1521,14 +1864,14 @@ class BackupInstance(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param friendly_name: Gets or sets the Backup Instance friendly name. - :type friendly_name: str - :param data_source_info: Required. Gets or sets the data source information. - :type data_source_info: ~azure.mgmt.dataprotection.models.Datasource - :param data_source_set_info: Gets or sets the data source set information. - :type data_source_set_info: ~azure.mgmt.dataprotection.models.DatasourceSet - :param policy_info: Required. Gets or sets the policy information. - :type policy_info: ~azure.mgmt.dataprotection.models.PolicyInfo + :ivar friendly_name: Gets or sets the Backup Instance friendly name. + :vartype friendly_name: str + :ivar data_source_info: Required. Gets or sets the data source information. + :vartype data_source_info: ~azure.mgmt.dataprotection.models.Datasource + :ivar data_source_set_info: Gets or sets the data source set information. + :vartype data_source_set_info: ~azure.mgmt.dataprotection.models.DatasourceSet + :ivar policy_info: Required. Gets or sets the policy information. + :vartype policy_info: ~azure.mgmt.dataprotection.models.PolicyInfo :ivar protection_status: Specifies the protection status of the resource. :vartype protection_status: ~azure.mgmt.dataprotection.models.ProtectionStatusDetails :ivar current_protection_state: Specifies the current protection state of the resource. @@ -1543,11 +1886,15 @@ class BackupInstance(msrest.serialization.Model): :ivar provisioning_state: Specifies the provisioning state of the resource i.e. provisioning/updating/Succeeded/Failed. :vartype provisioning_state: str - :param datasource_auth_credentials: Credentials to use to authenticate with data source + :ivar datasource_auth_credentials: Credentials to use to authenticate with data source provider. - :type datasource_auth_credentials: ~azure.mgmt.dataprotection.models.AuthCredentials - :param object_type: Required. - :type object_type: str + :vartype datasource_auth_credentials: ~azure.mgmt.dataprotection.models.AuthCredentials + :ivar validation_type: Specifies the type of validation. In case of DeepValidation, all + validations from /validateForBackup API will run again. Possible values include: + "ShallowValidation", "DeepValidation". + :vartype validation_type: str or ~azure.mgmt.dataprotection.models.ValidationType + :ivar object_type: Required. + :vartype object_type: str """ _validation = { @@ -1570,6 +1917,7 @@ class BackupInstance(msrest.serialization.Model): 'protection_error_details': {'key': 'protectionErrorDetails', 'type': 'UserFacingError'}, 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, 'datasource_auth_credentials': {'key': 'datasourceAuthCredentials', 'type': 'AuthCredentials'}, + 'validation_type': {'key': 'validationType', 'type': 'str'}, 'object_type': {'key': 'objectType', 'type': 'str'}, } @@ -1582,8 +1930,28 @@ def __init__( friendly_name: Optional[str] = None, data_source_set_info: Optional["DatasourceSet"] = None, datasource_auth_credentials: Optional["AuthCredentials"] = None, + validation_type: Optional[Union[str, "ValidationType"]] = None, **kwargs ): + """ + :keyword friendly_name: Gets or sets the Backup Instance friendly name. + :paramtype friendly_name: str + :keyword data_source_info: Required. Gets or sets the data source information. + :paramtype data_source_info: ~azure.mgmt.dataprotection.models.Datasource + :keyword data_source_set_info: Gets or sets the data source set information. + :paramtype data_source_set_info: ~azure.mgmt.dataprotection.models.DatasourceSet + :keyword policy_info: Required. Gets or sets the policy information. + :paramtype policy_info: ~azure.mgmt.dataprotection.models.PolicyInfo + :keyword datasource_auth_credentials: Credentials to use to authenticate with data source + provider. + :paramtype datasource_auth_credentials: ~azure.mgmt.dataprotection.models.AuthCredentials + :keyword validation_type: Specifies the type of validation. In case of DeepValidation, all + validations from /validateForBackup API will run again. Possible values include: + "ShallowValidation", "DeepValidation". + :paramtype validation_type: str or ~azure.mgmt.dataprotection.models.ValidationType + :keyword object_type: Required. + :paramtype object_type: str + """ super(BackupInstance, self).__init__(**kwargs) self.friendly_name = friendly_name self.data_source_info = data_source_info @@ -1594,6 +1962,7 @@ def __init__( self.protection_error_details = None self.provisioning_state = None self.datasource_auth_credentials = datasource_auth_credentials + self.validation_type = validation_type self.object_type = object_type @@ -1611,8 +1980,8 @@ class BackupInstanceResource(DppResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.dataprotection.models.SystemData - :param properties: BackupInstanceResource properties. - :type properties: ~azure.mgmt.dataprotection.models.BackupInstance + :ivar properties: BackupInstanceResource properties. + :vartype properties: ~azure.mgmt.dataprotection.models.BackupInstance """ _validation = { @@ -1636,6 +2005,10 @@ def __init__( properties: Optional["BackupInstance"] = None, **kwargs ): + """ + :keyword properties: BackupInstanceResource properties. + :paramtype properties: ~azure.mgmt.dataprotection.models.BackupInstance + """ super(BackupInstanceResource, self).__init__(**kwargs) self.properties = properties @@ -1643,11 +2016,11 @@ def __init__( class BackupInstanceResourceList(DppResourceList): """BackupInstance Resource list response. - :param next_link: The uri to fetch the next page of resources. Call ListNext() fetches next - page of resources. - :type next_link: str - :param value: List of resources. - :type value: list[~azure.mgmt.dataprotection.models.BackupInstanceResource] + :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.BackupInstanceResource] """ _attribute_map = { @@ -1662,6 +2035,13 @@ def __init__( value: Optional[List["BackupInstanceResource"]] = None, **kwargs ): + """ + :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.BackupInstanceResource] + """ super(BackupInstanceResourceList, self).__init__(next_link=next_link, **kwargs) self.value = value @@ -1674,10 +2054,10 @@ class BaseBackupPolicy(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param datasource_types: Required. Type of datasource for the backup management. - :type datasource_types: list[str] - :param object_type: Required. Constant filled by server. - :type object_type: str + :ivar datasource_types: Required. Type of datasource for the backup management. + :vartype datasource_types: list[str] + :ivar object_type: Required. Constant filled by server. + :vartype object_type: str """ _validation = { @@ -1700,6 +2080,10 @@ def __init__( datasource_types: List[str], **kwargs ): + """ + :keyword datasource_types: Required. Type of datasource for the backup management. + :paramtype datasource_types: list[str] + """ super(BaseBackupPolicy, self).__init__(**kwargs) self.datasource_types = datasource_types self.object_type = None # type: Optional[str] @@ -1710,13 +2094,13 @@ class BackupPolicy(BaseBackupPolicy): All required parameters must be populated in order to send to Azure. - :param datasource_types: Required. Type of datasource for the backup management. - :type datasource_types: list[str] - :param object_type: Required. Constant filled by server. - :type object_type: str - :param policy_rules: Required. Policy rule dictionary that contains rules for each backuptype + :ivar datasource_types: Required. Type of datasource for the backup management. + :vartype datasource_types: list[str] + :ivar object_type: Required. Constant filled by server. + :vartype object_type: str + :ivar policy_rules: Required. Policy rule dictionary that contains rules for each backuptype i.e Full/Incremental/Logs etc. - :type policy_rules: list[~azure.mgmt.dataprotection.models.BasePolicyRule] + :vartype policy_rules: list[~azure.mgmt.dataprotection.models.BasePolicyRule] """ _validation = { @@ -1738,6 +2122,13 @@ def __init__( policy_rules: List["BasePolicyRule"], **kwargs ): + """ + :keyword datasource_types: Required. Type of datasource for the backup management. + :paramtype datasource_types: list[str] + :keyword policy_rules: Required. Policy rule dictionary that contains rules for each backuptype + i.e Full/Incremental/Logs etc. + :paramtype policy_rules: list[~azure.mgmt.dataprotection.models.BasePolicyRule] + """ super(BackupPolicy, self).__init__(datasource_types=datasource_types, **kwargs) self.object_type = 'BackupPolicy' # type: str self.policy_rules = policy_rules @@ -1748,10 +2139,10 @@ class BackupSchedule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param repeating_time_intervals: Required. ISO 8601 repeating time interval format. - :type repeating_time_intervals: list[str] - :param time_zone: Time zone for a schedule. Example: Pacific Standard Time. - :type time_zone: str + :ivar repeating_time_intervals: Required. ISO 8601 repeating time interval format. + :vartype repeating_time_intervals: list[str] + :ivar time_zone: Time zone for a schedule. Example: Pacific Standard Time. + :vartype time_zone: str """ _validation = { @@ -1770,6 +2161,12 @@ def __init__( time_zone: Optional[str] = None, **kwargs ): + """ + :keyword repeating_time_intervals: Required. ISO 8601 repeating time interval format. + :paramtype repeating_time_intervals: list[str] + :keyword time_zone: Time zone for a schedule. Example: Pacific Standard Time. + :paramtype time_zone: str + """ super(BackupSchedule, self).__init__(**kwargs) self.repeating_time_intervals = repeating_time_intervals self.time_zone = time_zone @@ -1782,6 +2179,8 @@ class BackupVault(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. + :ivar monitoring_settings: Monitoring Settings. + :vartype monitoring_settings: ~azure.mgmt.dataprotection.models.MonitoringSettings :ivar provisioning_state: Provisioning state of the BackupVault resource. Possible values include: "Failed", "Provisioning", "Succeeded", "Unknown", "Updating". :vartype provisioning_state: str or ~azure.mgmt.dataprotection.models.ProvisioningState @@ -1791,8 +2190,8 @@ class BackupVault(msrest.serialization.Model): :vartype resource_move_state: str or ~azure.mgmt.dataprotection.models.ResourceMoveState :ivar resource_move_details: Resource move details for backup vault. :vartype resource_move_details: ~azure.mgmt.dataprotection.models.ResourceMoveDetails - :param storage_settings: Required. Storage Settings. - :type storage_settings: list[~azure.mgmt.dataprotection.models.StorageSetting] + :ivar storage_settings: Required. Storage Settings. + :vartype storage_settings: list[~azure.mgmt.dataprotection.models.StorageSetting] """ _validation = { @@ -1803,6 +2202,7 @@ class BackupVault(msrest.serialization.Model): } _attribute_map = { + 'monitoring_settings': {'key': 'monitoringSettings', 'type': 'MonitoringSettings'}, 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, 'resource_move_state': {'key': 'resourceMoveState', 'type': 'str'}, 'resource_move_details': {'key': 'resourceMoveDetails', 'type': 'ResourceMoveDetails'}, @@ -1813,9 +2213,17 @@ def __init__( self, *, storage_settings: List["StorageSetting"], + monitoring_settings: Optional["MonitoringSettings"] = None, **kwargs ): + """ + :keyword monitoring_settings: Monitoring Settings. + :paramtype monitoring_settings: ~azure.mgmt.dataprotection.models.MonitoringSettings + :keyword storage_settings: Required. Storage Settings. + :paramtype storage_settings: list[~azure.mgmt.dataprotection.models.StorageSetting] + """ super(BackupVault, self).__init__(**kwargs) + self.monitoring_settings = monitoring_settings self.provisioning_state = None self.resource_move_state = None self.resource_move_details = None @@ -1827,18 +2235,18 @@ class DppTrackedResource(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param e_tag: Optional ETag. - :type e_tag: str + :ivar e_tag: Optional ETag. + :vartype e_tag: str :ivar id: Resource Id represents the complete path to the resource. :vartype id: str - :param identity: Input Managed Identity Details. - :type identity: ~azure.mgmt.dataprotection.models.DppIdentityDetails - :param location: Resource location. - :type location: str + :ivar identity: Input Managed Identity Details. + :vartype identity: ~azure.mgmt.dataprotection.models.DppIdentityDetails + :ivar location: Resource location. + :vartype location: str :ivar name: Resource name associated with the resource. :vartype name: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar type: Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... :vartype type: str @@ -1873,6 +2281,16 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword e_tag: Optional ETag. + :paramtype e_tag: str + :keyword identity: Input Managed Identity Details. + :paramtype identity: ~azure.mgmt.dataprotection.models.DppIdentityDetails + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(DppTrackedResource, self).__init__(**kwargs) self.e_tag = e_tag self.id = None @@ -1891,25 +2309,25 @@ class BackupVaultResource(DppTrackedResource): All required parameters must be populated in order to send to Azure. - :param e_tag: Optional ETag. - :type e_tag: str + :ivar e_tag: Optional ETag. + :vartype e_tag: str :ivar id: Resource Id represents the complete path to the resource. :vartype id: str - :param identity: Input Managed Identity Details. - :type identity: ~azure.mgmt.dataprotection.models.DppIdentityDetails - :param location: Resource location. - :type location: str + :ivar identity: Input Managed Identity Details. + :vartype identity: ~azure.mgmt.dataprotection.models.DppIdentityDetails + :ivar location: Resource location. + :vartype location: str :ivar name: Resource name associated with the resource. :vartype name: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, 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 - :param properties: Required. BackupVaultResource properties. - :type properties: ~azure.mgmt.dataprotection.models.BackupVault + :ivar properties: Required. BackupVaultResource properties. + :vartype properties: ~azure.mgmt.dataprotection.models.BackupVault """ _validation = { @@ -1942,6 +2360,18 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword e_tag: Optional ETag. + :paramtype e_tag: str + :keyword identity: Input Managed Identity Details. + :paramtype identity: ~azure.mgmt.dataprotection.models.DppIdentityDetails + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword properties: Required. BackupVaultResource properties. + :paramtype properties: ~azure.mgmt.dataprotection.models.BackupVault + """ super(BackupVaultResource, self).__init__(e_tag=e_tag, identity=identity, location=location, tags=tags, **kwargs) self.properties = properties @@ -1949,11 +2379,11 @@ def __init__( class BackupVaultResourceList(DppResourceList): """List of BackupVault resources. - :param next_link: The uri to fetch the next page of resources. Call ListNext() fetches next - page of resources. - :type next_link: str - :param value: List of resources. - :type value: list[~azure.mgmt.dataprotection.models.BackupVaultResource] + :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.BackupVaultResource] """ _attribute_map = { @@ -1968,6 +2398,13 @@ def __init__( value: Optional[List["BackupVaultResource"]] = None, **kwargs ): + """ + :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.BackupVaultResource] + """ super(BackupVaultResourceList, self).__init__(next_link=next_link, **kwargs) self.value = value @@ -1986,8 +2423,8 @@ class BaseBackupPolicyResource(DppResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.dataprotection.models.SystemData - :param properties: BaseBackupPolicyResource properties. - :type properties: ~azure.mgmt.dataprotection.models.BaseBackupPolicy + :ivar properties: BaseBackupPolicyResource properties. + :vartype properties: ~azure.mgmt.dataprotection.models.BaseBackupPolicy """ _validation = { @@ -2011,6 +2448,10 @@ def __init__( properties: Optional["BaseBackupPolicy"] = None, **kwargs ): + """ + :keyword properties: BaseBackupPolicyResource properties. + :paramtype properties: ~azure.mgmt.dataprotection.models.BaseBackupPolicy + """ super(BaseBackupPolicyResource, self).__init__(**kwargs) self.properties = properties @@ -2018,11 +2459,11 @@ def __init__( class BaseBackupPolicyResourceList(DppResourceList): """List of BaseBackupPolicy resources. - :param next_link: The uri to fetch the next page of resources. Call ListNext() fetches next - page of resources. - :type next_link: str - :param value: List of resources. - :type value: list[~azure.mgmt.dataprotection.models.BaseBackupPolicyResource] + :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.BaseBackupPolicyResource] """ _attribute_map = { @@ -2037,6 +2478,13 @@ def __init__( value: Optional[List["BaseBackupPolicyResource"]] = None, **kwargs ): + """ + :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.BaseBackupPolicyResource] + """ super(BaseBackupPolicyResourceList, self).__init__(next_link=next_link, **kwargs) self.value = value @@ -2044,10 +2492,10 @@ def __init__( class CheckNameAvailabilityRequest(msrest.serialization.Model): """CheckNameAvailability Request. - :param name: Resource name for which availability needs to be checked. - :type name: str - :param type: Describes the Resource type: Microsoft.DataProtection/BackupVaults. - :type type: str + :ivar name: Resource name for which availability needs to be checked. + :vartype name: str + :ivar type: Describes the Resource type: Microsoft.DataProtection/BackupVaults. + :vartype type: str """ _attribute_map = { @@ -2062,6 +2510,12 @@ def __init__( type: Optional[str] = None, **kwargs ): + """ + :keyword name: Resource name for which availability needs to be checked. + :paramtype name: str + :keyword type: Describes the Resource type: Microsoft.DataProtection/BackupVaults. + :paramtype type: str + """ super(CheckNameAvailabilityRequest, self).__init__(**kwargs) self.name = name self.type = type @@ -2070,12 +2524,12 @@ def __init__( class CheckNameAvailabilityResult(msrest.serialization.Model): """CheckNameAvailability Result. - :param message: Gets or sets the message. - :type message: str - :param name_available: Gets or sets a value indicating whether [name available]. - :type name_available: bool - :param reason: Gets or sets the reason. - :type reason: str + :ivar message: Gets or sets the message. + :vartype message: str + :ivar name_available: Gets or sets a value indicating whether [name available]. + :vartype name_available: bool + :ivar reason: Gets or sets the reason. + :vartype reason: str """ _attribute_map = { @@ -2092,6 +2546,14 @@ def __init__( reason: Optional[str] = None, **kwargs ): + """ + :keyword message: Gets or sets the message. + :paramtype message: str + :keyword name_available: Gets or sets a value indicating whether [name available]. + :paramtype name_available: bool + :keyword reason: Gets or sets the reason. + :paramtype reason: str + """ super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.message = message self.name_available = name_available @@ -2101,14 +2563,14 @@ def __init__( class ClientDiscoveryDisplay(msrest.serialization.Model): """Localized display information of an operation. - :param description: Description of the operation having details of what operation is about. - :type description: str - :param operation: Operations Name itself. - :type operation: str - :param provider: Name of the provider for display purposes. - :type provider: str - :param resource: ResourceType for which this Operation can be performed. - :type resource: str + :ivar description: Description of the operation having details of what operation is about. + :vartype description: str + :ivar operation: Operations Name itself. + :vartype operation: str + :ivar provider: Name of the provider for display purposes. + :vartype provider: str + :ivar resource: ResourceType for which this Operation can be performed. + :vartype resource: str """ _attribute_map = { @@ -2127,6 +2589,16 @@ def __init__( resource: Optional[str] = None, **kwargs ): + """ + :keyword description: Description of the operation having details of what operation is about. + :paramtype description: str + :keyword operation: Operations Name itself. + :paramtype operation: str + :keyword provider: Name of the provider for display purposes. + :paramtype provider: str + :keyword resource: ResourceType for which this Operation can be performed. + :paramtype resource: str + """ super(ClientDiscoveryDisplay, self).__init__(**kwargs) self.description = description self.operation = operation @@ -2137,12 +2609,12 @@ def __init__( class ClientDiscoveryForLogSpecification(msrest.serialization.Model): """Class to represent shoebox log specification in json client discovery. - :param blob_duration: blob duration of shoebox log specification. - :type blob_duration: str - :param display_name: Localized display name. - :type display_name: str - :param name: Name for shoebox log specification. - :type name: str + :ivar blob_duration: blob duration of shoebox log specification. + :vartype blob_duration: str + :ivar display_name: Localized display name. + :vartype display_name: str + :ivar name: Name for shoebox log specification. + :vartype name: str """ _attribute_map = { @@ -2159,6 +2631,14 @@ def __init__( name: Optional[str] = None, **kwargs ): + """ + :keyword blob_duration: blob duration of shoebox log specification. + :paramtype blob_duration: str + :keyword display_name: Localized display name. + :paramtype display_name: str + :keyword name: Name for shoebox log specification. + :paramtype name: str + """ super(ClientDiscoveryForLogSpecification, self).__init__(**kwargs) self.blob_duration = blob_duration self.display_name = display_name @@ -2168,8 +2648,8 @@ def __init__( class ClientDiscoveryForProperties(msrest.serialization.Model): """Class to represent shoebox properties in json client discovery. - :param service_specification: Operation properties. - :type service_specification: + :ivar service_specification: Operation properties. + :vartype service_specification: ~azure.mgmt.dataprotection.models.ClientDiscoveryForServiceSpecification """ @@ -2183,6 +2663,11 @@ def __init__( service_specification: Optional["ClientDiscoveryForServiceSpecification"] = None, **kwargs ): + """ + :keyword service_specification: Operation properties. + :paramtype service_specification: + ~azure.mgmt.dataprotection.models.ClientDiscoveryForServiceSpecification + """ super(ClientDiscoveryForProperties, self).__init__(**kwargs) self.service_specification = service_specification @@ -2190,8 +2675,8 @@ def __init__( class ClientDiscoveryForServiceSpecification(msrest.serialization.Model): """Class to represent shoebox service specification in json client discovery. - :param log_specifications: List of log specifications of this operation. - :type log_specifications: + :ivar log_specifications: List of log specifications of this operation. + :vartype log_specifications: list[~azure.mgmt.dataprotection.models.ClientDiscoveryForLogSpecification] """ @@ -2205,6 +2690,11 @@ def __init__( log_specifications: Optional[List["ClientDiscoveryForLogSpecification"]] = None, **kwargs ): + """ + :keyword log_specifications: List of log specifications of this operation. + :paramtype log_specifications: + list[~azure.mgmt.dataprotection.models.ClientDiscoveryForLogSpecification] + """ super(ClientDiscoveryForServiceSpecification, self).__init__(**kwargs) self.log_specifications = log_specifications @@ -2212,10 +2702,10 @@ def __init__( class ClientDiscoveryResponse(msrest.serialization.Model): """Operations List response which contains list of available APIs. - :param next_link: Link to the next chunk of Response. - :type next_link: str - :param value: List of available operations. - :type value: list[~azure.mgmt.dataprotection.models.ClientDiscoveryValueForSingleApi] + :ivar next_link: Link to the next chunk of Response. + :vartype next_link: str + :ivar value: List of available operations. + :vartype value: list[~azure.mgmt.dataprotection.models.ClientDiscoveryValueForSingleApi] """ _attribute_map = { @@ -2230,6 +2720,12 @@ def __init__( value: Optional[List["ClientDiscoveryValueForSingleApi"]] = None, **kwargs ): + """ + :keyword next_link: Link to the next chunk of Response. + :paramtype next_link: str + :keyword value: List of available operations. + :paramtype value: list[~azure.mgmt.dataprotection.models.ClientDiscoveryValueForSingleApi] + """ super(ClientDiscoveryResponse, self).__init__(**kwargs) self.next_link = next_link self.value = value @@ -2238,17 +2734,17 @@ def __init__( class ClientDiscoveryValueForSingleApi(msrest.serialization.Model): """Available operation details. - :param display: Contains the localized display information for this particular operation. - :type display: ~azure.mgmt.dataprotection.models.ClientDiscoveryDisplay - :param name: Name of the Operation. - :type name: str - :param is_data_action: Indicates whether the operation is a data action. - :type is_data_action: bool - :param origin: The intended executor of the operation;governs the display of the operation in + :ivar display: Contains the localized display information for this particular operation. + :vartype display: ~azure.mgmt.dataprotection.models.ClientDiscoveryDisplay + :ivar name: Name of the Operation. + :vartype name: str + :ivar is_data_action: Indicates whether the operation is a data action. + :vartype is_data_action: bool + :ivar origin: The intended executor of the operation;governs the display of the operation in the RBAC UX and the audit logs UX. - :type origin: str - :param properties: Properties for the given operation. - :type properties: ~azure.mgmt.dataprotection.models.ClientDiscoveryForProperties + :vartype origin: str + :ivar properties: Properties for the given operation. + :vartype properties: ~azure.mgmt.dataprotection.models.ClientDiscoveryForProperties """ _attribute_map = { @@ -2269,6 +2765,19 @@ def __init__( properties: Optional["ClientDiscoveryForProperties"] = None, **kwargs ): + """ + :keyword display: Contains the localized display information for this particular operation. + :paramtype display: ~azure.mgmt.dataprotection.models.ClientDiscoveryDisplay + :keyword name: Name of the Operation. + :paramtype name: str + :keyword is_data_action: Indicates whether the operation is a data action. + :paramtype is_data_action: bool + :keyword origin: The intended executor of the operation;governs the display of the operation in + the RBAC UX and the audit logs UX. + :paramtype origin: str + :keyword properties: Properties for the given operation. + :paramtype properties: ~azure.mgmt.dataprotection.models.ClientDiscoveryForProperties + """ super(ClientDiscoveryValueForSingleApi, self).__init__(**kwargs) self.display = display self.name = name @@ -2285,9 +2794,9 @@ class CopyOption(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param object_type: Required. Type of the specific object - used for deserializing.Constant + :ivar object_type: Required. Type of the specific object - used for deserializing.Constant filled by server. - :type object_type: str + :vartype object_type: str """ _validation = { @@ -2306,6 +2815,8 @@ def __init__( self, **kwargs ): + """ + """ super(CopyOption, self).__init__(**kwargs) self.object_type = None # type: Optional[str] @@ -2315,9 +2826,9 @@ class CopyOnExpiryOption(CopyOption): All required parameters must be populated in order to send to Azure. - :param object_type: Required. Type of the specific object - used for deserializing.Constant + :ivar object_type: Required. Type of the specific object - used for deserializing.Constant filled by server. - :type object_type: str + :vartype object_type: str """ _validation = { @@ -2332,6 +2843,8 @@ def __init__( self, **kwargs ): + """ + """ super(CopyOnExpiryOption, self).__init__(**kwargs) self.object_type = 'CopyOnExpiryOption' # type: str @@ -2341,11 +2854,11 @@ class CustomCopyOption(CopyOption): All required parameters must be populated in order to send to Azure. - :param object_type: Required. Type of the specific object - used for deserializing.Constant + :ivar object_type: Required. Type of the specific object - used for deserializing.Constant filled by server. - :type object_type: str - :param duration: Data copied after given timespan. - :type duration: str + :vartype object_type: str + :ivar duration: Data copied after given timespan. + :vartype duration: str """ _validation = { @@ -2363,6 +2876,10 @@ def __init__( duration: Optional[str] = None, **kwargs ): + """ + :keyword duration: Data copied after given timespan. + :paramtype duration: str + """ super(CustomCopyOption, self).__init__(**kwargs) self.object_type = 'CustomCopyOption' # type: str self.duration = duration @@ -2373,21 +2890,21 @@ class Datasource(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param datasource_type: DatasourceType of the resource. - :type datasource_type: str - :param object_type: Type of Datasource object, used to initialize the right inherited type. - :type object_type: str - :param resource_id: Required. Full ARM ID of the resource. For azure resources, this is ARM ID. + :ivar datasource_type: DatasourceType of the resource. + :vartype datasource_type: str + :ivar object_type: Type of Datasource object, used to initialize the right inherited type. + :vartype object_type: str + :ivar resource_id: Required. Full ARM ID of the resource. For azure resources, this is ARM ID. For non azure resources, this will be the ID created by backup service via Fabric/Vault. - :type resource_id: str - :param resource_location: Location of datasource. - :type resource_location: str - :param resource_name: Unique identifier of the resource in the context of parent. - :type resource_name: str - :param resource_type: Resource Type of Datasource. - :type resource_type: str - :param resource_uri: Uri of the resource. - :type resource_uri: str + :vartype resource_id: str + :ivar resource_location: Location of datasource. + :vartype resource_location: str + :ivar resource_name: Unique identifier of the resource in the context of parent. + :vartype resource_name: str + :ivar resource_type: Resource Type of Datasource. + :vartype resource_type: str + :ivar resource_uri: Uri of the resource. + :vartype resource_uri: str """ _validation = { @@ -2416,6 +2933,23 @@ def __init__( resource_uri: Optional[str] = None, **kwargs ): + """ + :keyword datasource_type: DatasourceType of the resource. + :paramtype datasource_type: str + :keyword object_type: Type of Datasource object, used to initialize the right inherited type. + :paramtype object_type: str + :keyword resource_id: Required. Full ARM ID of the resource. For azure resources, this is ARM + ID. For non azure resources, this will be the ID created by backup service via Fabric/Vault. + :paramtype resource_id: str + :keyword resource_location: Location of datasource. + :paramtype resource_location: str + :keyword resource_name: Unique identifier of the resource in the context of parent. + :paramtype resource_name: str + :keyword resource_type: Resource Type of Datasource. + :paramtype resource_type: str + :keyword resource_uri: Uri of the resource. + :paramtype resource_uri: str + """ super(Datasource, self).__init__(**kwargs) self.datasource_type = datasource_type self.object_type = object_type @@ -2431,21 +2965,21 @@ class DatasourceSet(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param datasource_type: DatasourceType of the resource. - :type datasource_type: str - :param object_type: Type of Datasource object, used to initialize the right inherited type. - :type object_type: str - :param resource_id: Required. Full ARM ID of the resource. For azure resources, this is ARM ID. + :ivar datasource_type: DatasourceType of the resource. + :vartype datasource_type: str + :ivar object_type: Type of Datasource object, used to initialize the right inherited type. + :vartype object_type: str + :ivar resource_id: Required. Full ARM ID of the resource. For azure resources, this is ARM ID. For non azure resources, this will be the ID created by backup service via Fabric/Vault. - :type resource_id: str - :param resource_location: Location of datasource. - :type resource_location: str - :param resource_name: Unique identifier of the resource in the context of parent. - :type resource_name: str - :param resource_type: Resource Type of Datasource. - :type resource_type: str - :param resource_uri: Uri of the resource. - :type resource_uri: str + :vartype resource_id: str + :ivar resource_location: Location of datasource. + :vartype resource_location: str + :ivar resource_name: Unique identifier of the resource in the context of parent. + :vartype resource_name: str + :ivar resource_type: Resource Type of Datasource. + :vartype resource_type: str + :ivar resource_uri: Uri of the resource. + :vartype resource_uri: str """ _validation = { @@ -2474,6 +3008,23 @@ def __init__( resource_uri: Optional[str] = None, **kwargs ): + """ + :keyword datasource_type: DatasourceType of the resource. + :paramtype datasource_type: str + :keyword object_type: Type of Datasource object, used to initialize the right inherited type. + :paramtype object_type: str + :keyword resource_id: Required. Full ARM ID of the resource. For azure resources, this is ARM + ID. For non azure resources, this will be the ID created by backup service via Fabric/Vault. + :paramtype resource_id: str + :keyword resource_location: Location of datasource. + :paramtype resource_location: str + :keyword resource_name: Unique identifier of the resource in the context of parent. + :paramtype resource_name: str + :keyword resource_type: Resource Type of Datasource. + :paramtype resource_type: str + :keyword resource_uri: Uri of the resource. + :paramtype resource_uri: str + """ super(DatasourceSet, self).__init__(**kwargs) self.datasource_type = datasource_type self.object_type = object_type @@ -2489,12 +3040,12 @@ class DataStoreInfoBase(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param data_store_type: Required. type of datastore; Operational/Vault/Archive. Possible values + :ivar data_store_type: Required. type of datastore; Operational/Vault/Archive. Possible values include: "OperationalStore", "VaultStore", "ArchiveStore". - :type data_store_type: str or ~azure.mgmt.dataprotection.models.DataStoreTypes - :param object_type: Required. Type of Datasource object, used to initialize the right inherited + :vartype data_store_type: str or ~azure.mgmt.dataprotection.models.DataStoreTypes + :ivar object_type: Required. Type of Datasource object, used to initialize the right inherited type. - :type object_type: str + :vartype object_type: str """ _validation = { @@ -2514,6 +3065,14 @@ def __init__( object_type: str, **kwargs ): + """ + :keyword data_store_type: Required. type of datastore; Operational/Vault/Archive. Possible + values include: "OperationalStore", "VaultStore", "ArchiveStore". + :paramtype data_store_type: str or ~azure.mgmt.dataprotection.models.DataStoreTypes + :keyword object_type: Required. Type of Datasource object, used to initialize the right + inherited type. + :paramtype object_type: str + """ super(DataStoreInfoBase, self).__init__(**kwargs) self.data_store_type = data_store_type self.object_type = object_type @@ -2522,10 +3081,10 @@ def __init__( class Day(msrest.serialization.Model): """Day of the week. - :param date: Date of the month. - :type date: int - :param is_last: Whether Date is last date of month. - :type is_last: bool + :ivar date: Date of the month. + :vartype date: int + :ivar is_last: Whether Date is last date of month. + :vartype is_last: bool """ _attribute_map = { @@ -2540,6 +3099,12 @@ def __init__( is_last: Optional[bool] = None, **kwargs ): + """ + :keyword date: Date of the month. + :paramtype date: int + :keyword is_last: Whether Date is last date of month. + :paramtype is_last: bool + """ super(Day, self).__init__(**kwargs) self.date = date self.is_last = is_last @@ -2575,6 +3140,8 @@ def __init__( self, **kwargs ): + """ + """ super(DppBaseResource, self).__init__(**kwargs) self.id = None self.name = None @@ -2584,11 +3151,11 @@ def __init__( class DppBaseResourceList(msrest.serialization.Model): """Base for all lists of V2 resources. - :param value: List of Dpp resources. - :type value: list[~azure.mgmt.dataprotection.models.DppBaseResource] - :param next_link: The uri to fetch the next page of resources. Call ListNext() fetches next - page of resources. - :type next_link: str + :ivar value: List of Dpp resources. + :vartype value: list[~azure.mgmt.dataprotection.models.DppBaseResource] + :ivar next_link: The uri to fetch the next page of resources. Call ListNext() fetches next page + of resources. + :vartype next_link: str """ _attribute_map = { @@ -2603,6 +3170,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: List of Dpp resources. + :paramtype value: list[~azure.mgmt.dataprotection.models.DppBaseResource] + :keyword next_link: The uri to fetch the next page of resources. Call ListNext() fetches next + page of resources. + :paramtype next_link: str + """ super(DppBaseResourceList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2619,8 +3193,8 @@ class DppIdentityDetails(msrest.serialization.Model): :ivar tenant_id: A Globally Unique Identifier (GUID) that represents the Azure AD tenant where the resource is now a member. :vartype tenant_id: str - :param type: The identityType which can be either SystemAssigned or None. - :type type: str + :ivar type: The identityType which can be either SystemAssigned or None. + :vartype type: str """ _validation = { @@ -2640,6 +3214,10 @@ def __init__( type: Optional[str] = None, **kwargs ): + """ + :keyword type: The identityType which can be either SystemAssigned or None. + :paramtype type: str + """ super(DppIdentityDetails, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -2649,9 +3227,9 @@ def __init__( class DppTrackedResourceList(msrest.serialization.Model): """DppTrackedResourceList. - :param next_link: The uri to fetch the next page of resources. Call ListNext() fetches next - page of resources. - :type next_link: str + :ivar next_link: The uri to fetch the next page of resources. Call ListNext() fetches next page + of resources. + :vartype next_link: str """ _attribute_map = { @@ -2664,6 +3242,11 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword next_link: The uri to fetch the next page of resources. Call ListNext() fetches next + page of resources. + :paramtype next_link: str + """ super(DppTrackedResourceList, self).__init__(**kwargs) self.next_link = next_link @@ -2705,6 +3288,8 @@ def __init__( self, **kwargs ): + """ + """ super(Error, self).__init__(**kwargs) self.additional_info = None self.code = None @@ -2738,6 +3323,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorAdditionalInfo, self).__init__(**kwargs) self.info = None self.type = None @@ -2776,6 +3363,8 @@ def __init__( self, **kwargs ): + """ + """ super(ExportJobsResult, self).__init__(**kwargs) self.blob_url = None self.blob_sas_key = None @@ -2791,9 +3380,9 @@ class FeatureValidationRequestBase(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param object_type: Required. Type of the specific object - used for deserializing.Constant + :ivar object_type: Required. Type of the specific object - used for deserializing.Constant filled by server. - :type object_type: str + :vartype object_type: str """ _validation = { @@ -2812,6 +3401,8 @@ def __init__( self, **kwargs ): + """ + """ super(FeatureValidationRequestBase, self).__init__(**kwargs) self.object_type = None # type: Optional[str] @@ -2821,14 +3412,14 @@ class FeatureValidationRequest(FeatureValidationRequestBase): All required parameters must be populated in order to send to Azure. - :param object_type: Required. Type of the specific object - used for deserializing.Constant + :ivar object_type: Required. Type of the specific object - used for deserializing.Constant filled by server. - :type object_type: str - :param feature_type: backup support feature type. Possible values include: "Invalid", + :vartype object_type: str + :ivar feature_type: backup support feature type. Possible values include: "Invalid", "DataSourceType". - :type feature_type: str or ~azure.mgmt.dataprotection.models.FeatureType - :param feature_name: backup support feature name. - :type feature_name: str + :vartype feature_type: str or ~azure.mgmt.dataprotection.models.FeatureType + :ivar feature_name: backup support feature name. + :vartype feature_name: str """ _validation = { @@ -2848,6 +3439,13 @@ def __init__( feature_name: Optional[str] = None, **kwargs ): + """ + :keyword feature_type: backup support feature type. Possible values include: "Invalid", + "DataSourceType". + :paramtype feature_type: str or ~azure.mgmt.dataprotection.models.FeatureType + :keyword feature_name: backup support feature name. + :paramtype feature_name: str + """ super(FeatureValidationRequest, self).__init__(**kwargs) self.object_type = 'FeatureValidationRequest' # type: str self.feature_type = feature_type @@ -2862,9 +3460,9 @@ class FeatureValidationResponseBase(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param object_type: Required. Type of the specific object - used for deserializing.Constant + :ivar object_type: Required. Type of the specific object - used for deserializing.Constant filled by server. - :type object_type: str + :vartype object_type: str """ _validation = { @@ -2883,6 +3481,8 @@ def __init__( self, **kwargs ): + """ + """ super(FeatureValidationResponseBase, self).__init__(**kwargs) self.object_type = None # type: Optional[str] @@ -2892,14 +3492,14 @@ class FeatureValidationResponse(FeatureValidationResponseBase): All required parameters must be populated in order to send to Azure. - :param object_type: Required. Type of the specific object - used for deserializing.Constant + :ivar object_type: Required. Type of the specific object - used for deserializing.Constant filled by server. - :type object_type: str - :param feature_type: backup support feature type. Possible values include: "Invalid", + :vartype object_type: str + :ivar feature_type: backup support feature type. Possible values include: "Invalid", "DataSourceType". - :type feature_type: str or ~azure.mgmt.dataprotection.models.FeatureType - :param features: Response features. - :type features: list[~azure.mgmt.dataprotection.models.SupportedFeature] + :vartype feature_type: str or ~azure.mgmt.dataprotection.models.FeatureType + :ivar features: Response features. + :vartype features: list[~azure.mgmt.dataprotection.models.SupportedFeature] """ _validation = { @@ -2919,6 +3519,13 @@ def __init__( features: Optional[List["SupportedFeature"]] = None, **kwargs ): + """ + :keyword feature_type: backup support feature type. Possible values include: "Invalid", + "DataSourceType". + :paramtype feature_type: str or ~azure.mgmt.dataprotection.models.FeatureType + :keyword features: Response features. + :paramtype features: list[~azure.mgmt.dataprotection.models.SupportedFeature] + """ super(FeatureValidationResponse, self).__init__(**kwargs) self.object_type = 'FeatureValidationResponse' # type: str self.feature_type = feature_type @@ -2930,9 +3537,9 @@ class ImmediateCopyOption(CopyOption): All required parameters must be populated in order to send to Azure. - :param object_type: Required. Type of the specific object - used for deserializing.Constant + :ivar object_type: Required. Type of the specific object - used for deserializing.Constant filled by server. - :type object_type: str + :vartype object_type: str """ _validation = { @@ -2947,6 +3554,8 @@ def __init__( self, **kwargs ): + """ + """ super(ImmediateCopyOption, self).__init__(**kwargs) self.object_type = 'ImmediateCopyOption' # type: str @@ -2954,13 +3563,13 @@ def __init__( class InnerError(msrest.serialization.Model): """Inner Error. - :param additional_info: Any Key value pairs that can be provided to the client for additional + :ivar additional_info: Any Key value pairs that can be provided to the client for additional verbose information. - :type additional_info: dict[str, str] - :param code: Unique code for this error. - :type code: str - :param embedded_inner_error: Child Inner Error, to allow Nesting. - :type embedded_inner_error: ~azure.mgmt.dataprotection.models.InnerError + :vartype additional_info: dict[str, str] + :ivar code: Unique code for this error. + :vartype code: str + :ivar embedded_inner_error: Child Inner Error, to allow Nesting. + :vartype embedded_inner_error: ~azure.mgmt.dataprotection.models.InnerError """ _attribute_map = { @@ -2977,6 +3586,15 @@ def __init__( embedded_inner_error: Optional["InnerError"] = None, **kwargs ): + """ + :keyword additional_info: Any Key value pairs that can be provided to the client for additional + verbose information. + :paramtype additional_info: dict[str, str] + :keyword code: Unique code for this error. + :paramtype code: str + :keyword embedded_inner_error: Child Inner Error, to allow Nesting. + :paramtype embedded_inner_error: ~azure.mgmt.dataprotection.models.InnerError + """ super(InnerError, self).__init__(**kwargs) self.additional_info = additional_info self.code = code @@ -2987,13 +3605,13 @@ class ItemLevelRestoreCriteria(msrest.serialization.Model): """Class to contain criteria for item level restore. You probably want to use the sub-classes and not this class directly. Known - sub-classes are: RangeBasedItemLevelRestoreCriteria. + sub-classes are: KubernetesPVRestoreCriteria, KubernetesStorageClassRestoreCriteria, RangeBasedItemLevelRestoreCriteria. All required parameters must be populated in order to send to Azure. - :param object_type: Required. Type of the specific object - used for deserializing.Constant + :ivar object_type: Required. Type of the specific object - used for deserializing.Constant filled by server. - :type object_type: str + :vartype object_type: str """ _validation = { @@ -3005,13 +3623,15 @@ class ItemLevelRestoreCriteria(msrest.serialization.Model): } _subtype_map = { - 'object_type': {'RangeBasedItemLevelRestoreCriteria': 'RangeBasedItemLevelRestoreCriteria'} + 'object_type': {'KubernetesPVRestoreCriteria': 'KubernetesPVRestoreCriteria', 'KubernetesStorageClassRestoreCriteria': 'KubernetesStorageClassRestoreCriteria', 'RangeBasedItemLevelRestoreCriteria': 'RangeBasedItemLevelRestoreCriteria'} } def __init__( self, **kwargs ): + """ + """ super(ItemLevelRestoreCriteria, self).__init__(**kwargs) self.object_type = None # type: Optional[str] @@ -3024,13 +3644,13 @@ class RestoreTargetInfoBase(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param object_type: Required. Type of Datasource object, used to initialize the right inherited + :ivar object_type: Required. Type of Datasource object, used to initialize the right inherited type.Constant filled by server. - :type object_type: str - :param recovery_option: Required. Recovery Option. Possible values include: "FailIfExists". - :type recovery_option: str or ~azure.mgmt.dataprotection.models.RecoveryOption - :param restore_location: Target Restore region. - :type restore_location: str + :vartype object_type: str + :ivar recovery_option: Required. Recovery Option. Possible values include: "FailIfExists". + :vartype recovery_option: str or ~azure.mgmt.dataprotection.models.RecoveryOption + :ivar restore_location: Target Restore region. + :vartype restore_location: str """ _validation = { @@ -3055,6 +3675,12 @@ def __init__( restore_location: Optional[str] = None, **kwargs ): + """ + :keyword recovery_option: Required. Recovery Option. Possible values include: "FailIfExists". + :paramtype recovery_option: str or ~azure.mgmt.dataprotection.models.RecoveryOption + :keyword restore_location: Target Restore region. + :paramtype restore_location: str + """ super(RestoreTargetInfoBase, self).__init__(**kwargs) self.object_type = None # type: Optional[str] self.recovery_option = recovery_option @@ -3066,22 +3692,22 @@ class ItemLevelRestoreTargetInfo(RestoreTargetInfoBase): All required parameters must be populated in order to send to Azure. - :param object_type: Required. Type of Datasource object, used to initialize the right inherited + :ivar object_type: Required. Type of Datasource object, used to initialize the right inherited type.Constant filled by server. - :type object_type: str - :param recovery_option: Required. Recovery Option. Possible values include: "FailIfExists". - :type recovery_option: str or ~azure.mgmt.dataprotection.models.RecoveryOption - :param restore_location: Target Restore region. - :type restore_location: str - :param restore_criteria: Required. Restore Criteria. - :type restore_criteria: list[~azure.mgmt.dataprotection.models.ItemLevelRestoreCriteria] - :param datasource_info: Required. Information of target DS. - :type datasource_info: ~azure.mgmt.dataprotection.models.Datasource - :param datasource_set_info: Information of target DS Set. - :type datasource_set_info: ~azure.mgmt.dataprotection.models.DatasourceSet - :param datasource_auth_credentials: Credentials to use to authenticate with data source + :vartype object_type: str + :ivar recovery_option: Required. Recovery Option. Possible values include: "FailIfExists". + :vartype recovery_option: str or ~azure.mgmt.dataprotection.models.RecoveryOption + :ivar restore_location: Target Restore region. + :vartype restore_location: str + :ivar restore_criteria: Required. Restore Criteria. + :vartype restore_criteria: list[~azure.mgmt.dataprotection.models.ItemLevelRestoreCriteria] + :ivar datasource_info: Required. Information of target DS. + :vartype datasource_info: ~azure.mgmt.dataprotection.models.Datasource + :ivar datasource_set_info: Information of target DS Set. + :vartype datasource_set_info: ~azure.mgmt.dataprotection.models.DatasourceSet + :ivar datasource_auth_credentials: Credentials to use to authenticate with data source provider. - :type datasource_auth_credentials: ~azure.mgmt.dataprotection.models.AuthCredentials + :vartype datasource_auth_credentials: ~azure.mgmt.dataprotection.models.AuthCredentials """ _validation = { @@ -3112,6 +3738,21 @@ def __init__( datasource_auth_credentials: Optional["AuthCredentials"] = None, **kwargs ): + """ + :keyword recovery_option: Required. Recovery Option. Possible values include: "FailIfExists". + :paramtype recovery_option: str or ~azure.mgmt.dataprotection.models.RecoveryOption + :keyword restore_location: Target Restore region. + :paramtype restore_location: str + :keyword restore_criteria: Required. Restore Criteria. + :paramtype restore_criteria: list[~azure.mgmt.dataprotection.models.ItemLevelRestoreCriteria] + :keyword datasource_info: Required. Information of target DS. + :paramtype datasource_info: ~azure.mgmt.dataprotection.models.Datasource + :keyword datasource_set_info: Information of target DS Set. + :paramtype datasource_set_info: ~azure.mgmt.dataprotection.models.DatasourceSet + :keyword datasource_auth_credentials: Credentials to use to authenticate with data source + provider. + :paramtype datasource_auth_credentials: ~azure.mgmt.dataprotection.models.AuthCredentials + """ super(ItemLevelRestoreTargetInfo, self).__init__(recovery_option=recovery_option, restore_location=restore_location, **kwargs) self.object_type = 'ItemLevelRestoreTargetInfo' # type: str self.restore_criteria = restore_criteria @@ -3125,8 +3766,8 @@ class JobExtendedInfo(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param additional_details: Job's Additional Details. - :type additional_details: dict[str, str] + :ivar additional_details: Job's Additional Details. + :vartype additional_details: dict[str, str] :ivar backup_instance_state: State of the Backup Instance. :vartype backup_instance_state: str :ivar data_transferred_in_bytes: Number of bytes transferred. @@ -3166,6 +3807,10 @@ def __init__( additional_details: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword additional_details: Job's Additional Details. + :paramtype additional_details: dict[str, str] + """ super(JobExtendedInfo, self).__init__(**kwargs) self.additional_details = additional_details self.backup_instance_state = None @@ -3183,16 +3828,16 @@ class JobSubTask(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param additional_details: Additional details of Sub Tasks. - :type additional_details: dict[str, str] - :param task_id: Required. Task Id of the Sub Task. - :type task_id: int - :param task_name: Required. Name of the Sub Task. - :type task_name: str + :ivar additional_details: Additional details of Sub Tasks. + :vartype additional_details: dict[str, str] + :ivar task_id: Required. Task Id of the Sub Task. + :vartype task_id: int + :ivar task_name: Required. Name of the Sub Task. + :vartype task_name: str :ivar task_progress: Progress of the Sub Task. :vartype task_progress: str - :param task_status: Required. Status of the Sub Task. - :type task_status: str + :ivar task_status: Required. Status of the Sub Task. + :vartype task_status: str """ _validation = { @@ -3219,6 +3864,16 @@ def __init__( additional_details: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword additional_details: Additional details of Sub Tasks. + :paramtype additional_details: dict[str, str] + :keyword task_id: Required. Task Id of the Sub Task. + :paramtype task_id: int + :keyword task_name: Required. Name of the Sub Task. + :paramtype task_name: str + :keyword task_status: Required. Status of the Sub Task. + :paramtype task_status: str + """ super(JobSubTask, self).__init__(**kwargs) self.additional_details = additional_details self.task_id = task_id @@ -3227,6 +3882,119 @@ def __init__( self.task_status = task_status +class KubernetesPVRestoreCriteria(ItemLevelRestoreCriteria): + """Item Level kubernetes persistent volume target info for restore operation. + + All required parameters must be populated in order to send to Azure. + + :ivar object_type: Required. Type of the specific object - used for deserializing.Constant + filled by server. + :vartype object_type: str + :ivar name: Selected persistent volume claim name. + :vartype name: str + :ivar storage_class_name: Selected storage class name for restore operation. + :vartype storage_class_name: str + """ + + _validation = { + 'object_type': {'required': True}, + } + + _attribute_map = { + 'object_type': {'key': 'objectType', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'storage_class_name': {'key': 'storageClassName', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + storage_class_name: Optional[str] = None, + **kwargs + ): + """ + :keyword name: Selected persistent volume claim name. + :paramtype name: str + :keyword storage_class_name: Selected storage class name for restore operation. + :paramtype storage_class_name: str + """ + super(KubernetesPVRestoreCriteria, self).__init__(**kwargs) + self.object_type = 'KubernetesPVRestoreCriteria' # type: str + self.name = name + self.storage_class_name = storage_class_name + + +class KubernetesStorageClassRestoreCriteria(ItemLevelRestoreCriteria): + """Item Level kubernetes storage class target info for restore operation. + + All required parameters must be populated in order to send to Azure. + + :ivar object_type: Required. Type of the specific object - used for deserializing.Constant + filled by server. + :vartype object_type: str + :ivar selected_storage_class_name: Selected storage class name. + :vartype selected_storage_class_name: str + :ivar provisioner: Provisioner of the storage class. + :vartype provisioner: str + """ + + _validation = { + 'object_type': {'required': True}, + } + + _attribute_map = { + 'object_type': {'key': 'objectType', 'type': 'str'}, + 'selected_storage_class_name': {'key': 'selectedStorageClassName', 'type': 'str'}, + 'provisioner': {'key': 'provisioner', 'type': 'str'}, + } + + def __init__( + self, + *, + selected_storage_class_name: Optional[str] = None, + provisioner: Optional[str] = None, + **kwargs + ): + """ + :keyword selected_storage_class_name: Selected storage class name. + :paramtype selected_storage_class_name: str + :keyword provisioner: Provisioner of the storage class. + :paramtype provisioner: str + """ + super(KubernetesStorageClassRestoreCriteria, self).__init__(**kwargs) + self.object_type = 'KubernetesStorageClassRestoreCriteria' # type: str + self.selected_storage_class_name = selected_storage_class_name + self.provisioner = provisioner + + +class MonitoringSettings(msrest.serialization.Model): + """Monitoring Settings. + + :ivar azure_monitor_alert_settings: Settings for Azure Monitor based alerts. + :vartype azure_monitor_alert_settings: + ~azure.mgmt.dataprotection.models.AzureMonitorAlertSettings + """ + + _attribute_map = { + 'azure_monitor_alert_settings': {'key': 'azureMonitorAlertSettings', 'type': 'AzureMonitorAlertSettings'}, + } + + def __init__( + self, + *, + azure_monitor_alert_settings: Optional["AzureMonitorAlertSettings"] = None, + **kwargs + ): + """ + :keyword azure_monitor_alert_settings: Settings for Azure Monitor based alerts. + :paramtype azure_monitor_alert_settings: + ~azure.mgmt.dataprotection.models.AzureMonitorAlertSettings + """ + super(MonitoringSettings, self).__init__(**kwargs) + self.azure_monitor_alert_settings = azure_monitor_alert_settings + + class OperationExtendedInfo(msrest.serialization.Model): """Operation Extended Info. @@ -3235,9 +4003,9 @@ class OperationExtendedInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param object_type: Required. This property will be used as the discriminator for deciding the + :ivar object_type: Required. This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types.Constant filled by server. - :type object_type: str + :vartype object_type: str """ _validation = { @@ -3256,6 +4024,8 @@ def __init__( self, **kwargs ): + """ + """ super(OperationExtendedInfo, self).__init__(**kwargs) self.object_type = None # type: Optional[str] @@ -3265,11 +4035,11 @@ class OperationJobExtendedInfo(OperationExtendedInfo): All required parameters must be populated in order to send to Azure. - :param object_type: Required. This property will be used as the discriminator for deciding the + :ivar object_type: Required. This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types.Constant filled by server. - :type object_type: str - :param job_id: Arm Id of the job created for this operation. - :type job_id: str + :vartype object_type: str + :ivar job_id: Arm Id of the job created for this operation. + :vartype job_id: str """ _validation = { @@ -3287,6 +4057,10 @@ def __init__( job_id: Optional[str] = None, **kwargs ): + """ + :keyword job_id: Arm Id of the job created for this operation. + :paramtype job_id: str + """ super(OperationJobExtendedInfo, self).__init__(**kwargs) self.object_type = 'OperationJobExtendedInfo' # type: str self.job_id = job_id @@ -3295,24 +4069,24 @@ def __init__( class OperationResource(msrest.serialization.Model): """Operation Resource. - :param end_time: End time of the operation. - :type end_time: ~datetime.datetime - :param error: Required if status == failed or status == canceled. This is the OData v4 error + :ivar end_time: End time of the operation. + :vartype end_time: ~datetime.datetime + :ivar error: Required if status == failed or status == canceled. This is the OData v4 error format, used by the RPC and will go into the v2.2 Azure REST API guidelines. The full set of optional properties (e.g. inner errors / details) can be found in the "Error Response" section. - :type error: ~azure.mgmt.dataprotection.models.Error - :param id: It should match what is used to GET the operation result. - :type id: str - :param name: It must match the last segment of the "id" field, and will typically be a GUID / + :vartype error: ~azure.mgmt.dataprotection.models.Error + :ivar id: It should match what is used to GET the operation result. + :vartype id: str + :ivar name: It must match the last segment of the "id" field, and will typically be a GUID / system generated value. - :type name: str - :param properties: End time of the operation. - :type properties: ~azure.mgmt.dataprotection.models.OperationExtendedInfo - :param start_time: Start time of the operation. - :type start_time: ~datetime.datetime - :param status: - :type status: str + :vartype name: str + :ivar properties: End time of the operation. + :vartype properties: ~azure.mgmt.dataprotection.models.OperationExtendedInfo + :ivar start_time: Start time of the operation. + :vartype start_time: ~datetime.datetime + :ivar status: + :vartype status: str """ _attribute_map = { @@ -3337,6 +4111,26 @@ def __init__( status: Optional[str] = None, **kwargs ): + """ + :keyword end_time: End time of the operation. + :paramtype end_time: ~datetime.datetime + :keyword error: Required if status == failed or status == canceled. This is the OData v4 error + format, used by the RPC and will go into the v2.2 Azure REST API guidelines. + The full set of optional properties (e.g. inner errors / details) can be found in the "Error + Response" section. + :paramtype error: ~azure.mgmt.dataprotection.models.Error + :keyword id: It should match what is used to GET the operation result. + :paramtype id: str + :keyword name: It must match the last segment of the "id" field, and will typically be a GUID / + system generated value. + :paramtype name: str + :keyword properties: End time of the operation. + :paramtype properties: ~azure.mgmt.dataprotection.models.OperationExtendedInfo + :keyword start_time: Start time of the operation. + :paramtype start_time: ~datetime.datetime + :keyword status: + :paramtype status: str + """ super(OperationResource, self).__init__(**kwargs) self.end_time = end_time self.error = error @@ -3347,17 +4141,45 @@ def __init__( self.status = status +class PatchBackupVaultInput(msrest.serialization.Model): + """Backup Vault Contract for Patch Backup Vault API. + + :ivar monitoring_settings: Monitoring Settings. + :vartype monitoring_settings: ~azure.mgmt.dataprotection.models.MonitoringSettings + """ + + _attribute_map = { + 'monitoring_settings': {'key': 'monitoringSettings', 'type': 'MonitoringSettings'}, + } + + def __init__( + self, + *, + monitoring_settings: Optional["MonitoringSettings"] = None, + **kwargs + ): + """ + :keyword monitoring_settings: Monitoring Settings. + :paramtype monitoring_settings: ~azure.mgmt.dataprotection.models.MonitoringSettings + """ + super(PatchBackupVaultInput, self).__init__(**kwargs) + self.monitoring_settings = monitoring_settings + + class PatchResourceRequestInput(msrest.serialization.Model): """Patch Request content for Microsoft.DataProtection resources. - :param identity: Input Managed Identity Details. - :type identity: ~azure.mgmt.dataprotection.models.DppIdentityDetails - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar identity: Input Managed Identity Details. + :vartype identity: ~azure.mgmt.dataprotection.models.DppIdentityDetails + :ivar properties: Resource properties. + :vartype properties: ~azure.mgmt.dataprotection.models.PatchBackupVaultInput + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _attribute_map = { 'identity': {'key': 'identity', 'type': 'DppIdentityDetails'}, + 'properties': {'key': 'properties', 'type': 'PatchBackupVaultInput'}, 'tags': {'key': 'tags', 'type': '{str}'}, } @@ -3365,11 +4187,21 @@ def __init__( self, *, identity: Optional["DppIdentityDetails"] = None, + properties: Optional["PatchBackupVaultInput"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword identity: Input Managed Identity Details. + :paramtype identity: ~azure.mgmt.dataprotection.models.DppIdentityDetails + :keyword properties: Resource properties. + :paramtype properties: ~azure.mgmt.dataprotection.models.PatchBackupVaultInput + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(PatchResourceRequestInput, self).__init__(**kwargs) self.identity = identity + self.properties = properties self.tags = tags @@ -3380,12 +4212,12 @@ class PolicyInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param policy_id: Required. - :type policy_id: str + :ivar policy_id: Required. + :vartype policy_id: str :ivar policy_version: :vartype policy_version: str - :param policy_parameters: Policy parameters for the backup instance. - :type policy_parameters: ~azure.mgmt.dataprotection.models.PolicyParameters + :ivar policy_parameters: Policy parameters for the backup instance. + :vartype policy_parameters: ~azure.mgmt.dataprotection.models.PolicyParameters """ _validation = { @@ -3406,6 +4238,12 @@ def __init__( policy_parameters: Optional["PolicyParameters"] = None, **kwargs ): + """ + :keyword policy_id: Required. + :paramtype policy_id: str + :keyword policy_parameters: Policy parameters for the backup instance. + :paramtype policy_parameters: ~azure.mgmt.dataprotection.models.PolicyParameters + """ super(PolicyInfo, self).__init__(**kwargs) self.policy_id = policy_id self.policy_version = None @@ -3415,8 +4253,9 @@ def __init__( class PolicyParameters(msrest.serialization.Model): """Parameters in Policy. - :param data_store_parameters_list: Gets or sets the DataStore Parameters. - :type data_store_parameters_list: list[~azure.mgmt.dataprotection.models.DataStoreParameters] + :ivar data_store_parameters_list: Gets or sets the DataStore Parameters. + :vartype data_store_parameters_list: + list[~azure.mgmt.dataprotection.models.DataStoreParameters] """ _attribute_map = { @@ -3429,6 +4268,11 @@ def __init__( data_store_parameters_list: Optional[List["DataStoreParameters"]] = None, **kwargs ): + """ + :keyword data_store_parameters_list: Gets or sets the DataStore Parameters. + :paramtype data_store_parameters_list: + list[~azure.mgmt.dataprotection.models.DataStoreParameters] + """ super(PolicyParameters, self).__init__(**kwargs) self.data_store_parameters_list = data_store_parameters_list @@ -3436,12 +4280,12 @@ def __init__( class ProtectionStatusDetails(msrest.serialization.Model): """Protection status details. - :param error_details: Specifies the protection status error of the resource. - :type error_details: ~azure.mgmt.dataprotection.models.UserFacingError - :param status: Specifies the protection status of the resource. Possible values include: + :ivar error_details: Specifies the protection status error of the resource. + :vartype error_details: ~azure.mgmt.dataprotection.models.UserFacingError + :ivar status: Specifies the protection status of the resource. Possible values include: "ConfiguringProtection", "ConfiguringProtectionFailed", "ProtectionConfigured", "ProtectionStopped", "SoftDeleted", "SoftDeleting". - :type status: str or ~azure.mgmt.dataprotection.models.Status + :vartype status: str or ~azure.mgmt.dataprotection.models.Status """ _attribute_map = { @@ -3456,6 +4300,14 @@ def __init__( status: Optional[Union[str, "Status"]] = None, **kwargs ): + """ + :keyword error_details: Specifies the protection status error of the resource. + :paramtype error_details: ~azure.mgmt.dataprotection.models.UserFacingError + :keyword status: Specifies the protection status of the resource. Possible values include: + "ConfiguringProtection", "ConfiguringProtectionFailed", "ProtectionConfigured", + "ProtectionStopped", "SoftDeleted", "SoftDeleting". + :paramtype status: str or ~azure.mgmt.dataprotection.models.Status + """ super(ProtectionStatusDetails, self).__init__(**kwargs) self.error_details = error_details self.status = status @@ -3466,13 +4318,13 @@ class RangeBasedItemLevelRestoreCriteria(ItemLevelRestoreCriteria): All required parameters must be populated in order to send to Azure. - :param object_type: Required. Type of the specific object - used for deserializing.Constant + :ivar object_type: Required. Type of the specific object - used for deserializing.Constant filled by server. - :type object_type: str - :param min_matching_value: minimum value for range prefix match. - :type min_matching_value: str - :param max_matching_value: maximum value for range prefix match. - :type max_matching_value: str + :vartype object_type: str + :ivar min_matching_value: minimum value for range prefix match. + :vartype min_matching_value: str + :ivar max_matching_value: maximum value for range prefix match. + :vartype max_matching_value: str """ _validation = { @@ -3492,6 +4344,12 @@ def __init__( max_matching_value: Optional[str] = None, **kwargs ): + """ + :keyword min_matching_value: minimum value for range prefix match. + :paramtype min_matching_value: str + :keyword max_matching_value: maximum value for range prefix match. + :paramtype max_matching_value: str + """ super(RangeBasedItemLevelRestoreCriteria, self).__init__(**kwargs) self.object_type = 'RangeBasedItemLevelRestoreCriteria' # type: str self.min_matching_value = min_matching_value @@ -3503,23 +4361,23 @@ class RecoveryPointDataStoreDetails(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param creation_time: - :type creation_time: ~datetime.datetime - :param expiry_time: - :type expiry_time: ~datetime.datetime - :param id: - :type id: str - :param meta_data: - :type meta_data: str - :param state: - :type state: str - :param type: - :type type: str - :param visible: - :type visible: bool + :ivar creation_time: + :vartype creation_time: ~datetime.datetime + :ivar expiry_time: + :vartype expiry_time: ~datetime.datetime + :ivar id: + :vartype id: str + :ivar meta_data: + :vartype meta_data: str + :ivar state: + :vartype state: str + :ivar type: + :vartype type: str + :ivar visible: + :vartype visible: bool :ivar rehydration_expiry_time: :vartype rehydration_expiry_time: ~datetime.datetime - :ivar rehydration_status: Possible values include: "CREATE_IN_PROGRESS", "COMPLETED", + :ivar rehydration_status: Possible values include: "CREATE_IN_PROGRESS", "COMPLETED", "DELETE_IN_PROGRESS", "DELETED", "FAILED". :vartype rehydration_status: str or ~azure.mgmt.dataprotection.models.RehydrationStatus """ @@ -3553,6 +4411,22 @@ def __init__( visible: Optional[bool] = None, **kwargs ): + """ + :keyword creation_time: + :paramtype creation_time: ~datetime.datetime + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword id: + :paramtype id: str + :keyword meta_data: + :paramtype meta_data: str + :keyword state: + :paramtype state: str + :keyword type: + :paramtype type: str + :keyword visible: + :paramtype visible: bool + """ super(RecoveryPointDataStoreDetails, self).__init__(**kwargs) self.creation_time = creation_time self.expiry_time = expiry_time @@ -3568,18 +4442,18 @@ def __init__( class RecoveryPointsFilters(msrest.serialization.Model): """RecoveryPointsFilters. - :param restore_point_data_store_id: - :type restore_point_data_store_id: str - :param is_visible: - :type is_visible: bool - :param start_date: - :type start_date: str - :param end_date: - :type end_date: str - :param extended_info: - :type extended_info: bool - :param restore_point_state: - :type restore_point_state: str + :ivar restore_point_data_store_id: + :vartype restore_point_data_store_id: str + :ivar is_visible: + :vartype is_visible: bool + :ivar start_date: + :vartype start_date: str + :ivar end_date: + :vartype end_date: str + :ivar extended_info: + :vartype extended_info: bool + :ivar restore_point_state: + :vartype restore_point_state: str """ _attribute_map = { @@ -3602,6 +4476,20 @@ def __init__( restore_point_state: Optional[str] = None, **kwargs ): + """ + :keyword restore_point_data_store_id: + :paramtype restore_point_data_store_id: str + :keyword is_visible: + :paramtype is_visible: bool + :keyword start_date: + :paramtype start_date: str + :keyword end_date: + :paramtype end_date: str + :keyword extended_info: + :paramtype extended_info: bool + :keyword restore_point_state: + :paramtype restore_point_state: str + """ super(RecoveryPointsFilters, self).__init__(**kwargs) self.restore_point_data_store_id = restore_point_data_store_id self.is_visible = is_visible @@ -3636,7 +4524,6 @@ class ResourceGuard(msrest.serialization.Model): 'provisioning_state': {'readonly': True}, 'allow_auto_approvals': {'readonly': True}, 'resource_guard_operations': {'readonly': True}, - 'vault_critical_operation_exclusion_list': {'readonly': True}, 'description': {'readonly': True}, } @@ -3650,13 +4537,20 @@ class ResourceGuard(msrest.serialization.Model): def __init__( self, + *, + vault_critical_operation_exclusion_list: Optional[List[str]] = None, **kwargs ): + """ + :keyword vault_critical_operation_exclusion_list: List of critical operations which are not + protected by this resourceGuard. + :paramtype vault_critical_operation_exclusion_list: list[str] + """ super(ResourceGuard, self).__init__(**kwargs) self.provisioning_state = None self.allow_auto_approvals = None self.resource_guard_operations = None - self.vault_critical_operation_exclusion_list = None + self.vault_critical_operation_exclusion_list = vault_critical_operation_exclusion_list self.description = None @@ -3685,6 +4579,8 @@ def __init__( self, **kwargs ): + """ + """ super(ResourceGuardOperation, self).__init__(**kwargs) self.vault_critical_operation = None self.request_resource_type = None @@ -3695,25 +4591,25 @@ class ResourceGuardResource(DppTrackedResource): Variables are only populated by the server, and will be ignored when sending a request. - :param e_tag: Optional ETag. - :type e_tag: str + :ivar e_tag: Optional ETag. + :vartype e_tag: str :ivar id: Resource Id represents the complete path to the resource. :vartype id: str - :param identity: Input Managed Identity Details. - :type identity: ~azure.mgmt.dataprotection.models.DppIdentityDetails - :param location: Resource location. - :type location: str + :ivar identity: Input Managed Identity Details. + :vartype identity: ~azure.mgmt.dataprotection.models.DppIdentityDetails + :ivar location: Resource location. + :vartype location: str :ivar name: Resource name associated with the resource. :vartype name: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, 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 - :param properties: ResourceGuardResource properties. - :type properties: ~azure.mgmt.dataprotection.models.ResourceGuard + :ivar properties: ResourceGuardResource properties. + :vartype properties: ~azure.mgmt.dataprotection.models.ResourceGuard """ _validation = { @@ -3745,6 +4641,18 @@ def __init__( properties: Optional["ResourceGuard"] = None, **kwargs ): + """ + :keyword e_tag: Optional ETag. + :paramtype e_tag: str + :keyword identity: Input Managed Identity Details. + :paramtype identity: ~azure.mgmt.dataprotection.models.DppIdentityDetails + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword properties: ResourceGuardResource properties. + :paramtype properties: ~azure.mgmt.dataprotection.models.ResourceGuard + """ super(ResourceGuardResource, self).__init__(e_tag=e_tag, identity=identity, location=location, tags=tags, **kwargs) self.properties = properties @@ -3752,11 +4660,11 @@ def __init__( class ResourceGuardResourceList(DppTrackedResourceList): """List of ResourceGuard resources. - :param next_link: The uri to fetch the next page of resources. Call ListNext() fetches next - page of resources. - :type next_link: str - :param value: List of resources. - :type value: list[~azure.mgmt.dataprotection.models.ResourceGuardResource] + :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.ResourceGuardResource] """ _attribute_map = { @@ -3771,6 +4679,13 @@ def __init__( value: Optional[List["ResourceGuardResource"]] = None, **kwargs ): + """ + :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.ResourceGuardResource] + """ super(ResourceGuardResourceList, self).__init__(next_link=next_link, **kwargs) self.value = value @@ -3778,19 +4693,19 @@ def __init__( class ResourceMoveDetails(msrest.serialization.Model): """ResourceMoveDetails will be returned in response to GetResource call from ARM. - :param operation_id: CorrelationId of latest ResourceMove operation attempted. - :type operation_id: str - :param start_time_utc: Start time in UTC of latest ResourceMove operation attempted. ISO 8601 + :ivar operation_id: CorrelationId of latest ResourceMove operation attempted. + :vartype operation_id: str + :ivar start_time_utc: Start time in UTC of latest ResourceMove operation attempted. ISO 8601 format. - :type start_time_utc: str - :param completion_time_utc: Completion time in UTC of latest ResourceMove operation attempted. + :vartype start_time_utc: str + :ivar completion_time_utc: Completion time in UTC of latest ResourceMove operation attempted. ISO 8601 format. - :type completion_time_utc: str - :param source_resource_path: ARM resource path of source resource. - :type source_resource_path: str - :param target_resource_path: ARM resource path of target resource used in latest ResourceMove + :vartype completion_time_utc: str + :ivar source_resource_path: ARM resource path of source resource. + :vartype source_resource_path: str + :ivar target_resource_path: ARM resource path of target resource used in latest ResourceMove operation. - :type target_resource_path: str + :vartype target_resource_path: str """ _attribute_map = { @@ -3811,6 +4726,21 @@ def __init__( target_resource_path: Optional[str] = None, **kwargs ): + """ + :keyword operation_id: CorrelationId of latest ResourceMove operation attempted. + :paramtype operation_id: str + :keyword start_time_utc: Start time in UTC of latest ResourceMove operation attempted. ISO 8601 + format. + :paramtype start_time_utc: str + :keyword completion_time_utc: Completion time in UTC of latest ResourceMove operation + attempted. ISO 8601 format. + :paramtype completion_time_utc: str + :keyword source_resource_path: ARM resource path of source resource. + :paramtype source_resource_path: str + :keyword target_resource_path: ARM resource path of target resource used in latest ResourceMove + operation. + :paramtype target_resource_path: str + """ super(ResourceMoveDetails, self).__init__(**kwargs) self.operation_id = operation_id self.start_time_utc = start_time_utc @@ -3824,12 +4754,12 @@ class RestorableTimeRange(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param start_time: Required. Start time for the available restore range. - :type start_time: str - :param end_time: Required. End time for the available restore range. - :type end_time: str - :param object_type: - :type object_type: str + :ivar start_time: Required. Start time for the available restore range. + :vartype start_time: str + :ivar end_time: Required. End time for the available restore range. + :vartype end_time: str + :ivar object_type: + :vartype object_type: str """ _validation = { @@ -3851,6 +4781,14 @@ def __init__( object_type: Optional[str] = None, **kwargs ): + """ + :keyword start_time: Required. Start time for the available restore range. + :paramtype start_time: str + :keyword end_time: Required. End time for the available restore range. + :paramtype end_time: str + :keyword object_type: + :paramtype object_type: str + """ super(RestorableTimeRange, self).__init__(**kwargs) self.start_time = start_time self.end_time = end_time @@ -3862,16 +4800,16 @@ class RestoreFilesTargetInfo(RestoreTargetInfoBase): All required parameters must be populated in order to send to Azure. - :param object_type: Required. Type of Datasource object, used to initialize the right inherited + :ivar object_type: Required. Type of Datasource object, used to initialize the right inherited type.Constant filled by server. - :type object_type: str - :param recovery_option: Required. Recovery Option. Possible values include: "FailIfExists". - :type recovery_option: str or ~azure.mgmt.dataprotection.models.RecoveryOption - :param restore_location: Target Restore region. - :type restore_location: str - :param target_details: Required. Destination of RestoreAsFiles operation, when destination is + :vartype object_type: str + :ivar recovery_option: Required. Recovery Option. Possible values include: "FailIfExists". + :vartype recovery_option: str or ~azure.mgmt.dataprotection.models.RecoveryOption + :ivar restore_location: Target Restore region. + :vartype restore_location: str + :ivar target_details: Required. Destination of RestoreAsFiles operation, when destination is not a datasource. - :type target_details: ~azure.mgmt.dataprotection.models.TargetDetails + :vartype target_details: ~azure.mgmt.dataprotection.models.TargetDetails """ _validation = { @@ -3895,6 +4833,15 @@ def __init__( restore_location: Optional[str] = None, **kwargs ): + """ + :keyword recovery_option: Required. Recovery Option. Possible values include: "FailIfExists". + :paramtype recovery_option: str or ~azure.mgmt.dataprotection.models.RecoveryOption + :keyword restore_location: Target Restore region. + :paramtype restore_location: str + :keyword target_details: Required. Destination of RestoreAsFiles operation, when destination is + not a datasource. + :paramtype target_details: ~azure.mgmt.dataprotection.models.TargetDetails + """ super(RestoreFilesTargetInfo, self).__init__(recovery_option=recovery_option, restore_location=restore_location, **kwargs) self.object_type = 'RestoreFilesTargetInfo' # type: str self.target_details = target_details @@ -3903,10 +4850,10 @@ def __init__( class RestoreJobRecoveryPointDetails(msrest.serialization.Model): """RestoreJobRecoveryPointDetails. - :param recovery_point_id: - :type recovery_point_id: str - :param recovery_point_time: - :type recovery_point_time: ~datetime.datetime + :ivar recovery_point_id: + :vartype recovery_point_id: str + :ivar recovery_point_time: + :vartype recovery_point_time: ~datetime.datetime """ _attribute_map = { @@ -3921,6 +4868,12 @@ def __init__( recovery_point_time: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword recovery_point_id: + :paramtype recovery_point_id: str + :keyword recovery_point_time: + :paramtype recovery_point_time: ~datetime.datetime + """ super(RestoreJobRecoveryPointDetails, self).__init__(**kwargs) self.recovery_point_id = recovery_point_id self.recovery_point_time = recovery_point_time @@ -3931,20 +4884,20 @@ class RestoreTargetInfo(RestoreTargetInfoBase): All required parameters must be populated in order to send to Azure. - :param object_type: Required. Type of Datasource object, used to initialize the right inherited + :ivar object_type: Required. Type of Datasource object, used to initialize the right inherited type.Constant filled by server. - :type object_type: str - :param recovery_option: Required. Recovery Option. Possible values include: "FailIfExists". - :type recovery_option: str or ~azure.mgmt.dataprotection.models.RecoveryOption - :param restore_location: Target Restore region. - :type restore_location: str - :param datasource_info: Required. Information of target DS. - :type datasource_info: ~azure.mgmt.dataprotection.models.Datasource - :param datasource_set_info: Information of target DS Set. - :type datasource_set_info: ~azure.mgmt.dataprotection.models.DatasourceSet - :param datasource_auth_credentials: Credentials to use to authenticate with data source + :vartype object_type: str + :ivar recovery_option: Required. Recovery Option. Possible values include: "FailIfExists". + :vartype recovery_option: str or ~azure.mgmt.dataprotection.models.RecoveryOption + :ivar restore_location: Target Restore region. + :vartype restore_location: str + :ivar datasource_info: Required. Information of target DS. + :vartype datasource_info: ~azure.mgmt.dataprotection.models.Datasource + :ivar datasource_set_info: Information of target DS Set. + :vartype datasource_set_info: ~azure.mgmt.dataprotection.models.DatasourceSet + :ivar datasource_auth_credentials: Credentials to use to authenticate with data source provider. - :type datasource_auth_credentials: ~azure.mgmt.dataprotection.models.AuthCredentials + :vartype datasource_auth_credentials: ~azure.mgmt.dataprotection.models.AuthCredentials """ _validation = { @@ -3972,6 +4925,19 @@ def __init__( datasource_auth_credentials: Optional["AuthCredentials"] = None, **kwargs ): + """ + :keyword recovery_option: Required. Recovery Option. Possible values include: "FailIfExists". + :paramtype recovery_option: str or ~azure.mgmt.dataprotection.models.RecoveryOption + :keyword restore_location: Target Restore region. + :paramtype restore_location: str + :keyword datasource_info: Required. Information of target DS. + :paramtype datasource_info: ~azure.mgmt.dataprotection.models.Datasource + :keyword datasource_set_info: Information of target DS Set. + :paramtype datasource_set_info: ~azure.mgmt.dataprotection.models.DatasourceSet + :keyword datasource_auth_credentials: Credentials to use to authenticate with data source + provider. + :paramtype datasource_auth_credentials: ~azure.mgmt.dataprotection.models.AuthCredentials + """ super(RestoreTargetInfo, self).__init__(recovery_option=recovery_option, restore_location=restore_location, **kwargs) self.object_type = 'RestoreTargetInfo' # type: str self.datasource_info = datasource_info @@ -3990,8 +4956,8 @@ class RetentionTag(msrest.serialization.Model): :vartype e_tag: str :ivar id: Retention Tag version. :vartype id: str - :param tag_name: Required. Retention Tag Name to relate it to retention rule. - :type tag_name: str + :ivar tag_name: Required. Retention Tag Name to relate it to retention rule. + :vartype tag_name: str """ _validation = { @@ -4012,6 +4978,10 @@ def __init__( tag_name: str, **kwargs ): + """ + :keyword tag_name: Required. Retention Tag Name to relate it to retention rule. + :paramtype tag_name: str + """ super(RetentionTag, self).__init__(**kwargs) self.e_tag = None self.id = None @@ -4023,23 +4993,23 @@ class ScheduleBasedBackupCriteria(BackupCriteria): All required parameters must be populated in order to send to Azure. - :param object_type: Required. Type of the specific object - used for deserializing.Constant + :ivar object_type: Required. Type of the specific object - used for deserializing.Constant filled by server. - :type object_type: str - :param absolute_criteria: it contains absolute values like "AllBackup" / "FirstOfDay" / + :vartype object_type: str + :ivar absolute_criteria: it contains absolute values like "AllBackup" / "FirstOfDay" / "FirstOfWeek" / "FirstOfMonth" and should be part of AbsoluteMarker enum. - :type absolute_criteria: list[str or ~azure.mgmt.dataprotection.models.AbsoluteMarker] - :param days_of_month: This is day of the month from 1 to 28 other wise last of month. - :type days_of_month: list[~azure.mgmt.dataprotection.models.Day] - :param days_of_the_week: It should be Sunday/Monday/T..../Saturday. - :type days_of_the_week: list[str or ~azure.mgmt.dataprotection.models.DayOfWeek] - :param months_of_year: It should be January/February/....../December. - :type months_of_year: list[str or ~azure.mgmt.dataprotection.models.Month] - :param schedule_times: List of schedule times for backup. - :type schedule_times: list[~datetime.datetime] - :param weeks_of_the_month: It should be First/Second/Third/Fourth/Last. - :type weeks_of_the_month: list[str or ~azure.mgmt.dataprotection.models.WeekNumber] + :vartype absolute_criteria: list[str or ~azure.mgmt.dataprotection.models.AbsoluteMarker] + :ivar days_of_month: This is day of the month from 1 to 28 other wise last of month. + :vartype days_of_month: list[~azure.mgmt.dataprotection.models.Day] + :ivar days_of_the_week: It should be Sunday/Monday/T..../Saturday. + :vartype days_of_the_week: list[str or ~azure.mgmt.dataprotection.models.DayOfWeek] + :ivar months_of_year: It should be January/February/....../December. + :vartype months_of_year: list[str or ~azure.mgmt.dataprotection.models.Month] + :ivar schedule_times: List of schedule times for backup. + :vartype schedule_times: list[~datetime.datetime] + :ivar weeks_of_the_month: It should be First/Second/Third/Fourth/Last. + :vartype weeks_of_the_month: list[str or ~azure.mgmt.dataprotection.models.WeekNumber] """ _validation = { @@ -4067,6 +5037,22 @@ def __init__( weeks_of_the_month: Optional[List[Union[str, "WeekNumber"]]] = None, **kwargs ): + """ + :keyword absolute_criteria: it contains absolute values like "AllBackup" / "FirstOfDay" / + "FirstOfWeek" / "FirstOfMonth" + and should be part of AbsoluteMarker enum. + :paramtype absolute_criteria: list[str or ~azure.mgmt.dataprotection.models.AbsoluteMarker] + :keyword days_of_month: This is day of the month from 1 to 28 other wise last of month. + :paramtype days_of_month: list[~azure.mgmt.dataprotection.models.Day] + :keyword days_of_the_week: It should be Sunday/Monday/T..../Saturday. + :paramtype days_of_the_week: list[str or ~azure.mgmt.dataprotection.models.DayOfWeek] + :keyword months_of_year: It should be January/February/....../December. + :paramtype months_of_year: list[str or ~azure.mgmt.dataprotection.models.Month] + :keyword schedule_times: List of schedule times for backup. + :paramtype schedule_times: list[~datetime.datetime] + :keyword weeks_of_the_month: It should be First/Second/Third/Fourth/Last. + :paramtype weeks_of_the_month: list[str or ~azure.mgmt.dataprotection.models.WeekNumber] + """ super(ScheduleBasedBackupCriteria, self).__init__(**kwargs) self.object_type = 'ScheduleBasedBackupCriteria' # type: str self.absolute_criteria = absolute_criteria @@ -4082,13 +5068,13 @@ class ScheduleBasedTriggerContext(TriggerContext): All required parameters must be populated in order to send to Azure. - :param object_type: Required. Type of the specific object - used for deserializing.Constant + :ivar object_type: Required. Type of the specific object - used for deserializing.Constant filled by server. - :type object_type: str - :param schedule: Required. Schedule for this backup. - :type schedule: ~azure.mgmt.dataprotection.models.BackupSchedule - :param tagging_criteria: Required. List of tags that can be applicable for given schedule. - :type tagging_criteria: list[~azure.mgmt.dataprotection.models.TaggingCriteria] + :vartype object_type: str + :ivar schedule: Required. Schedule for this backup. + :vartype schedule: ~azure.mgmt.dataprotection.models.BackupSchedule + :ivar tagging_criteria: Required. List of tags that can be applicable for given schedule. + :vartype tagging_criteria: list[~azure.mgmt.dataprotection.models.TaggingCriteria] """ _validation = { @@ -4110,6 +5096,12 @@ def __init__( tagging_criteria: List["TaggingCriteria"], **kwargs ): + """ + :keyword schedule: Required. Schedule for this backup. + :paramtype schedule: ~azure.mgmt.dataprotection.models.BackupSchedule + :keyword tagging_criteria: Required. List of tags that can be applicable for given schedule. + :paramtype tagging_criteria: list[~azure.mgmt.dataprotection.models.TaggingCriteria] + """ super(ScheduleBasedTriggerContext, self).__init__(**kwargs) self.object_type = 'ScheduleBasedTriggerContext' # type: str self.schedule = schedule @@ -4121,11 +5113,11 @@ class SecretStoreBasedAuthCredentials(AuthCredentials): All required parameters must be populated in order to send to Azure. - :param object_type: Required. Type of the specific object - used for deserializing.Constant + :ivar object_type: Required. Type of the specific object - used for deserializing.Constant filled by server. - :type object_type: str - :param secret_store_resource: Secret store resource. - :type secret_store_resource: ~azure.mgmt.dataprotection.models.SecretStoreResource + :vartype object_type: str + :ivar secret_store_resource: Secret store resource. + :vartype secret_store_resource: ~azure.mgmt.dataprotection.models.SecretStoreResource """ _validation = { @@ -4143,6 +5135,10 @@ def __init__( secret_store_resource: Optional["SecretStoreResource"] = None, **kwargs ): + """ + :keyword secret_store_resource: Secret store resource. + :paramtype secret_store_resource: ~azure.mgmt.dataprotection.models.SecretStoreResource + """ super(SecretStoreBasedAuthCredentials, self).__init__(**kwargs) self.object_type = 'SecretStoreBasedAuthCredentials' # type: str self.secret_store_resource = secret_store_resource @@ -4153,11 +5149,13 @@ class SecretStoreResource(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param uri: Uri to get to the resource. - :type uri: str - :param secret_store_type: Required. Gets or sets the type of secret store. Possible values + :ivar uri: Uri to get to the resource. + :vartype uri: str + :ivar secret_store_type: Required. Gets or sets the type of secret store. Possible values include: "Invalid", "AzureKeyVault". - :type secret_store_type: str or ~azure.mgmt.dataprotection.models.SecretStoreType + :vartype secret_store_type: str or ~azure.mgmt.dataprotection.models.SecretStoreType + :ivar value: Gets or sets value stored in secret store resource. + :vartype value: str """ _validation = { @@ -4167,6 +5165,7 @@ class SecretStoreResource(msrest.serialization.Model): _attribute_map = { 'uri': {'key': 'uri', 'type': 'str'}, 'secret_store_type': {'key': 'secretStoreType', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, } def __init__( @@ -4174,11 +5173,22 @@ def __init__( *, secret_store_type: Union[str, "SecretStoreType"], uri: Optional[str] = None, + value: Optional[str] = None, **kwargs ): + """ + :keyword uri: Uri to get to the resource. + :paramtype uri: str + :keyword secret_store_type: Required. Gets or sets the type of secret store. Possible values + include: "Invalid", "AzureKeyVault". + :paramtype secret_store_type: str or ~azure.mgmt.dataprotection.models.SecretStoreType + :keyword value: Gets or sets value stored in secret store resource. + :paramtype value: str + """ super(SecretStoreResource, self).__init__(**kwargs) self.uri = uri self.secret_store_type = secret_store_type + self.value = value class SourceLifeCycle(msrest.serialization.Model): @@ -4186,12 +5196,12 @@ class SourceLifeCycle(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param delete_after: Required. Delete Option. - :type delete_after: ~azure.mgmt.dataprotection.models.DeleteOption - :param source_data_store: Required. DataStoreInfo base. - :type source_data_store: ~azure.mgmt.dataprotection.models.DataStoreInfoBase - :param target_data_store_copy_settings: - :type target_data_store_copy_settings: + :ivar delete_after: Required. Delete Option. + :vartype delete_after: ~azure.mgmt.dataprotection.models.DeleteOption + :ivar source_data_store: Required. DataStoreInfo base. + :vartype source_data_store: ~azure.mgmt.dataprotection.models.DataStoreInfoBase + :ivar target_data_store_copy_settings: + :vartype target_data_store_copy_settings: list[~azure.mgmt.dataprotection.models.TargetCopySetting] """ @@ -4214,6 +5224,15 @@ def __init__( target_data_store_copy_settings: Optional[List["TargetCopySetting"]] = None, **kwargs ): + """ + :keyword delete_after: Required. Delete Option. + :paramtype delete_after: ~azure.mgmt.dataprotection.models.DeleteOption + :keyword source_data_store: Required. DataStoreInfo base. + :paramtype source_data_store: ~azure.mgmt.dataprotection.models.DataStoreInfoBase + :keyword target_data_store_copy_settings: + :paramtype target_data_store_copy_settings: + list[~azure.mgmt.dataprotection.models.TargetCopySetting] + """ super(SourceLifeCycle, self).__init__(**kwargs) self.delete_after = delete_after self.source_data_store = source_data_store @@ -4223,12 +5242,11 @@ def __init__( class StorageSetting(msrest.serialization.Model): """Storage setting. - :param datastore_type: Gets or sets the type of the datastore. Possible values include: + :ivar datastore_type: Gets or sets the type of the datastore. Possible values include: "ArchiveStore", "SnapshotStore", "VaultStore". - :type datastore_type: str or ~azure.mgmt.dataprotection.models.StorageSettingStoreTypes - :param type: Gets or sets the type. Possible values include: "GeoRedundant", - "LocallyRedundant". - :type type: str or ~azure.mgmt.dataprotection.models.StorageSettingTypes + :vartype datastore_type: str or ~azure.mgmt.dataprotection.models.StorageSettingStoreTypes + :ivar type: Gets or sets the type. Possible values include: "GeoRedundant", "LocallyRedundant". + :vartype type: str or ~azure.mgmt.dataprotection.models.StorageSettingTypes """ _attribute_map = { @@ -4243,6 +5261,14 @@ def __init__( type: Optional[Union[str, "StorageSettingTypes"]] = None, **kwargs ): + """ + :keyword datastore_type: Gets or sets the type of the datastore. Possible values include: + "ArchiveStore", "SnapshotStore", "VaultStore". + :paramtype datastore_type: str or ~azure.mgmt.dataprotection.models.StorageSettingStoreTypes + :keyword type: Gets or sets the type. Possible values include: "GeoRedundant", + "LocallyRedundant". + :paramtype type: str or ~azure.mgmt.dataprotection.models.StorageSettingTypes + """ super(StorageSetting, self).__init__(**kwargs) self.datastore_type = datastore_type self.type = type @@ -4251,13 +5277,13 @@ def __init__( class SupportedFeature(msrest.serialization.Model): """Elements class for feature request. - :param feature_name: support feature type. - :type feature_name: str - :param support_status: feature support status. Possible values include: "Invalid", + :ivar feature_name: support feature type. + :vartype feature_name: str + :ivar support_status: feature support status. Possible values include: "Invalid", "NotSupported", "AlphaPreview", "PrivatePreview", "PublicPreview", "GenerallyAvailable". - :type support_status: str or ~azure.mgmt.dataprotection.models.FeatureSupportStatus - :param exposure_controlled_features: support feature type. - :type exposure_controlled_features: list[str] + :vartype support_status: str or ~azure.mgmt.dataprotection.models.FeatureSupportStatus + :ivar exposure_controlled_features: support feature type. + :vartype exposure_controlled_features: list[str] """ _attribute_map = { @@ -4274,29 +5300,65 @@ def __init__( exposure_controlled_features: Optional[List[str]] = None, **kwargs ): + """ + :keyword feature_name: support feature type. + :paramtype feature_name: str + :keyword support_status: feature support status. Possible values include: "Invalid", + "NotSupported", "AlphaPreview", "PrivatePreview", "PublicPreview", "GenerallyAvailable". + :paramtype support_status: str or ~azure.mgmt.dataprotection.models.FeatureSupportStatus + :keyword exposure_controlled_features: support feature type. + :paramtype exposure_controlled_features: list[str] + """ super(SupportedFeature, self).__init__(**kwargs) self.feature_name = feature_name self.support_status = support_status self.exposure_controlled_features = exposure_controlled_features +class SyncBackupInstanceRequest(msrest.serialization.Model): + """Sync BackupInstance Request. + + :ivar sync_type: Field indicating sync type e.g. to sync only in case of failure or in all + cases. Possible values include: "Default", "ForceResync". + :vartype sync_type: str or ~azure.mgmt.dataprotection.models.SyncType + """ + + _attribute_map = { + 'sync_type': {'key': 'syncType', 'type': 'str'}, + } + + def __init__( + self, + *, + sync_type: Optional[Union[str, "SyncType"]] = None, + **kwargs + ): + """ + :keyword sync_type: Field indicating sync type e.g. to sync only in case of failure or in all + cases. Possible values include: "Default", "ForceResync". + :paramtype sync_type: str or ~azure.mgmt.dataprotection.models.SyncType + """ + super(SyncBackupInstanceRequest, self).__init__(**kwargs) + self.sync_type = sync_type + + class SystemData(msrest.serialization.Model): """Metadata pertaining to creation and last modification of the resource. - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure.mgmt.dataprotection.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Possible values include: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or ~azure.mgmt.dataprotection.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or ~azure.mgmt.dataprotection.models.CreatedByType - :param last_modified_at: The type of identity that last modified the resource. - :type last_modified_at: ~datetime.datetime + :vartype last_modified_by_type: str or ~azure.mgmt.dataprotection.models.CreatedByType + :ivar last_modified_at: The type of identity that last modified the resource. + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -4319,6 +5381,22 @@ def __init__( last_modified_at: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or ~azure.mgmt.dataprotection.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or ~azure.mgmt.dataprotection.models.CreatedByType + :keyword last_modified_at: The type of identity that last modified the resource. + :paramtype last_modified_at: ~datetime.datetime + """ super(SystemData, self).__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type @@ -4333,14 +5411,14 @@ class TaggingCriteria(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param criteria: Criteria which decides whether the tag can be applied to a triggered backup. - :type criteria: list[~azure.mgmt.dataprotection.models.BackupCriteria] - :param is_default: Required. Specifies if tag is default. - :type is_default: bool - :param tagging_priority: Required. Retention Tag priority. - :type tagging_priority: long - :param tag_info: Required. Retention tag information. - :type tag_info: ~azure.mgmt.dataprotection.models.RetentionTag + :ivar criteria: Criteria which decides whether the tag can be applied to a triggered backup. + :vartype criteria: list[~azure.mgmt.dataprotection.models.BackupCriteria] + :ivar is_default: Required. Specifies if tag is default. + :vartype is_default: bool + :ivar tagging_priority: Required. Retention Tag priority. + :vartype tagging_priority: long + :ivar tag_info: Required. Retention tag information. + :vartype tag_info: ~azure.mgmt.dataprotection.models.RetentionTag """ _validation = { @@ -4365,6 +5443,16 @@ def __init__( criteria: Optional[List["BackupCriteria"]] = None, **kwargs ): + """ + :keyword criteria: Criteria which decides whether the tag can be applied to a triggered backup. + :paramtype criteria: list[~azure.mgmt.dataprotection.models.BackupCriteria] + :keyword is_default: Required. Specifies if tag is default. + :paramtype is_default: bool + :keyword tagging_priority: Required. Retention Tag priority. + :paramtype tagging_priority: long + :keyword tag_info: Required. Retention tag information. + :paramtype tag_info: ~azure.mgmt.dataprotection.models.RetentionTag + """ super(TaggingCriteria, self).__init__(**kwargs) self.criteria = criteria self.is_default = is_default @@ -4377,10 +5465,10 @@ class TargetCopySetting(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param copy_after: Required. It can be CustomCopyOption or ImmediateCopyOption. - :type copy_after: ~azure.mgmt.dataprotection.models.CopyOption - :param data_store: Required. Info of target datastore. - :type data_store: ~azure.mgmt.dataprotection.models.DataStoreInfoBase + :ivar copy_after: Required. It can be CustomCopyOption or ImmediateCopyOption. + :vartype copy_after: ~azure.mgmt.dataprotection.models.CopyOption + :ivar data_store: Required. Info of target datastore. + :vartype data_store: ~azure.mgmt.dataprotection.models.DataStoreInfoBase """ _validation = { @@ -4400,6 +5488,12 @@ def __init__( data_store: "DataStoreInfoBase", **kwargs ): + """ + :keyword copy_after: Required. It can be CustomCopyOption or ImmediateCopyOption. + :paramtype copy_after: ~azure.mgmt.dataprotection.models.CopyOption + :keyword data_store: Required. Info of target datastore. + :paramtype data_store: ~azure.mgmt.dataprotection.models.DataStoreInfoBase + """ super(TargetCopySetting, self).__init__(**kwargs) self.copy_after = copy_after self.data_store = data_store @@ -4410,20 +5504,20 @@ class TargetDetails(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param file_prefix: Required. Restore operation may create multiple files inside location + :ivar file_prefix: Required. Restore operation may create multiple files inside location pointed by Url Below will be the common prefix for all of them. - :type file_prefix: str - :param restore_target_location_type: Required. Denotes the target location where the data will + :vartype file_prefix: str + :ivar restore_target_location_type: Required. Denotes the target location where the data will be restored, string value for the enum {Microsoft.Internal.AzureBackup.DataProtection.Common.Interface.RestoreTargetLocationType}. Possible values include: "Invalid", "AzureBlobs", "AzureFiles". - :type restore_target_location_type: str or + :vartype restore_target_location_type: str or ~azure.mgmt.dataprotection.models.RestoreTargetLocationType - :param url: Required. Url denoting the restore destination. It can point to container / file + :ivar url: Required. Url denoting the restore destination. It can point to container / file share etc. - :type url: str + :vartype url: str """ _validation = { @@ -4446,6 +5540,22 @@ def __init__( url: str, **kwargs ): + """ + :keyword file_prefix: Required. Restore operation may create multiple files inside location + pointed by Url + Below will be the common prefix for all of them. + :paramtype file_prefix: str + :keyword restore_target_location_type: Required. Denotes the target location where the data + will be restored, + string value for the enum + {Microsoft.Internal.AzureBackup.DataProtection.Common.Interface.RestoreTargetLocationType}. + Possible values include: "Invalid", "AzureBlobs", "AzureFiles". + :paramtype restore_target_location_type: str or + ~azure.mgmt.dataprotection.models.RestoreTargetLocationType + :keyword url: Required. Url denoting the restore destination. It can point to container / file + share etc. + :paramtype url: str + """ super(TargetDetails, self).__init__(**kwargs) self.file_prefix = file_prefix self.restore_target_location_type = restore_target_location_type @@ -4457,9 +5567,9 @@ class TriggerBackupRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param backup_rule_options: Required. Name for the Rule of the Policy which needs to be applied + :ivar backup_rule_options: Required. Name for the Rule of the Policy which needs to be applied for this backup. - :type backup_rule_options: ~azure.mgmt.dataprotection.models.AdHocBackupRuleOptions + :vartype backup_rule_options: ~azure.mgmt.dataprotection.models.AdHocBackupRuleOptions """ _validation = { @@ -4476,6 +5586,11 @@ def __init__( backup_rule_options: "AdHocBackupRuleOptions", **kwargs ): + """ + :keyword backup_rule_options: Required. Name for the Rule of the Policy which needs to be + applied for this backup. + :paramtype backup_rule_options: ~azure.mgmt.dataprotection.models.AdHocBackupRuleOptions + """ super(TriggerBackupRequest, self).__init__(**kwargs) self.backup_rule_options = backup_rule_options @@ -4483,24 +5598,24 @@ def __init__( class UserFacingError(msrest.serialization.Model): """Error object used by layers that have access to localized content, and propagate that to user. - :param code: Unique code for this error. - :type code: str - :param details: Additional related Errors. - :type details: list[~azure.mgmt.dataprotection.models.UserFacingError] - :param inner_error: Inner Error. - :type inner_error: ~azure.mgmt.dataprotection.models.InnerError - :param is_retryable: Whether the operation will be retryable or not. - :type is_retryable: bool - :param is_user_error: Whether the operation is due to a user error or service error. - :type is_user_error: bool - :param properties: Any key value pairs that can be injected inside error object. - :type properties: dict[str, str] - :param message: - :type message: str - :param recommended_action: RecommendedAction � localized. - :type recommended_action: list[str] - :param target: Target of the error. - :type target: str + :ivar code: Unique code for this error. + :vartype code: str + :ivar details: Additional related Errors. + :vartype details: list[~azure.mgmt.dataprotection.models.UserFacingError] + :ivar inner_error: Inner Error. + :vartype inner_error: ~azure.mgmt.dataprotection.models.InnerError + :ivar is_retryable: Whether the operation will be retryable or not. + :vartype is_retryable: bool + :ivar is_user_error: Whether the operation is due to a user error or service error. + :vartype is_user_error: bool + :ivar properties: Any key value pairs that can be injected inside error object. + :vartype properties: dict[str, str] + :ivar message: + :vartype message: str + :ivar recommended_action: RecommendedAction � localized. + :vartype recommended_action: list[str] + :ivar target: Target of the error. + :vartype target: str """ _attribute_map = { @@ -4529,6 +5644,26 @@ def __init__( target: Optional[str] = None, **kwargs ): + """ + :keyword code: Unique code for this error. + :paramtype code: str + :keyword details: Additional related Errors. + :paramtype details: list[~azure.mgmt.dataprotection.models.UserFacingError] + :keyword inner_error: Inner Error. + :paramtype inner_error: ~azure.mgmt.dataprotection.models.InnerError + :keyword is_retryable: Whether the operation will be retryable or not. + :paramtype is_retryable: bool + :keyword is_user_error: Whether the operation is due to a user error or service error. + :paramtype is_user_error: bool + :keyword properties: Any key value pairs that can be injected inside error object. + :paramtype properties: dict[str, str] + :keyword message: + :paramtype message: str + :keyword recommended_action: RecommendedAction � localized. + :paramtype recommended_action: list[str] + :keyword target: Target of the error. + :paramtype target: str + """ super(UserFacingError, self).__init__(**kwargs) self.code = code self.details = details @@ -4546,8 +5681,8 @@ class ValidateForBackupRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param backup_instance: Required. Backup Instance. - :type backup_instance: ~azure.mgmt.dataprotection.models.BackupInstance + :ivar backup_instance: Required. Backup Instance. + :vartype backup_instance: ~azure.mgmt.dataprotection.models.BackupInstance """ _validation = { @@ -4564,6 +5699,10 @@ def __init__( backup_instance: "BackupInstance", **kwargs ): + """ + :keyword backup_instance: Required. Backup Instance. + :paramtype backup_instance: ~azure.mgmt.dataprotection.models.BackupInstance + """ super(ValidateForBackupRequest, self).__init__(**kwargs) self.backup_instance = backup_instance @@ -4573,8 +5712,8 @@ class ValidateRestoreRequestObject(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param restore_request_object: Required. Gets or sets the restore request object. - :type restore_request_object: ~azure.mgmt.dataprotection.models.AzureBackupRestoreRequest + :ivar restore_request_object: Required. Gets or sets the restore request object. + :vartype restore_request_object: ~azure.mgmt.dataprotection.models.AzureBackupRestoreRequest """ _validation = { @@ -4591,5 +5730,9 @@ def __init__( restore_request_object: "AzureBackupRestoreRequest", **kwargs ): + """ + :keyword restore_request_object: Required. Gets or sets the restore request object. + :paramtype restore_request_object: ~azure.mgmt.dataprotection.models.AzureBackupRestoreRequest + """ super(ValidateRestoreRequestObject, self).__init__(**kwargs) self.restore_request_object = restore_request_object diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/__init__.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/__init__.py index f9c765bb82a0..bf5d55f651c4 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 @@ -9,6 +9,8 @@ from ._backup_vaults_operations import BackupVaultsOperations from ._operation_result_operations import OperationResultOperations from ._operation_status_operations import OperationStatusOperations +from ._operation_status_backup_vault_context_operations import OperationStatusBackupVaultContextOperations +from ._operation_status_resource_group_context_operations import OperationStatusResourceGroupContextOperations from ._backup_vault_operation_results_operations import BackupVaultOperationResultsOperations from ._data_protection_operations import DataProtectionOperations from ._data_protection_operations_operations import DataProtectionOperationsOperations @@ -25,6 +27,8 @@ 'BackupVaultsOperations', 'OperationResultOperations', 'OperationStatusOperations', + 'OperationStatusBackupVaultContextOperations', + 'OperationStatusResourceGroupContextOperations', 'BackupVaultOperationResultsOperations', 'DataProtectionOperations', 'DataProtectionOperationsOperations', 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 68829a4eb021..1c81c6374c62 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_instances_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_instances_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,27 +6,653 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class BackupInstancesOperations(object): +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances") # 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'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}") # 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'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}") # 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'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}") # 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'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_adhoc_backup_request_initial( + subscription_id: str, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/backup") # 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'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_validate_for_backup_request_initial( + subscription_id: str, + resource_group_name: str, + vault_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/validateForBackup") # 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'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_backup_instance_operation_result_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + operation_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/operationResults/{operationId}") # 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'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, 'str'), + "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_trigger_rehydrate_request_initial( + resource_group_name: str, + subscription_id: str, + vault_name: str, + backup_instance_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/rehydrate") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_trigger_restore_request_initial( + subscription_id: str, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/restore") # 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'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_resume_backups_request_initial( + subscription_id: str, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/resumeBackups") # 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'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_resume_protection_request_initial( + subscription_id: str, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/resumeProtection") # 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'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_stop_protection_request_initial( + subscription_id: str, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/stopProtection") # 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'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_suspend_backups_request_initial( + subscription_id: str, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/suspendBackups") # 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'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_sync_backup_instance_request_initial( + subscription_id: str, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/sync") # 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'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_validate_for_restore_request_initial( + subscription_id: str, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/validateRestore") # 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'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + +class BackupInstancesOperations(object): # pylint: disable=too-many-public-methods """BackupInstancesOperations operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -47,59 +674,62 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - vault_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.BackupInstanceResourceList"] + resource_group_name: str, + vault_name: str, + **kwargs: Any + ) -> Iterable["_models.BackupInstanceResourceList"]: """Gets a backup instances belonging to a backup vault. - :param vault_name: The name of the backup vault. - :type vault_name: str :param resource_group_name: The name of the resource group where the backup vault is present. :type resource_group_name: str + :param vault_name: The name of the backup vault. + :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 BackupInstanceResourceList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.BackupInstanceResourceList] + :return: An iterator like instance of either BackupInstanceResourceList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.BackupInstanceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupInstanceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('BackupInstanceResourceList', pipeline_response) + deserialized = self._deserialize("BackupInstanceResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,7 +738,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -117,25 +751,26 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances"} # type: ignore + @distributed_trace def get( self, - vault_name, # type: str - resource_group_name, # type: str - backup_instance_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BackupInstanceResource" + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + **kwargs: Any + ) -> "_models.BackupInstanceResource": """Gets a backup instance with name in a backup vault. - :param vault_name: The name of the backup vault. - :type vault_name: str :param resource_group_name: The name of the resource group where the backup vault is present. :type resource_group_name: str + :param vault_name: The name of the backup vault. + :type vault_name: str :param backup_instance_name: The name of the backup instance. :type backup_instance_name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -148,29 +783,26 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'backupInstanceName': self._serialize.url("backup_instance_name", backup_instance_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-04-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -183,97 +815,108 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}"} # type: ignore + def _create_or_update_initial( self, - vault_name, # type: str - resource_group_name, # type: str - backup_instance_name, # type: str - parameters, # type: "_models.BackupInstanceResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.BackupInstanceResource" - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupInstanceResource"] + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: "_models.BackupInstanceResource", + **kwargs: Any + ) -> Optional["_models.BackupInstanceResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.BackupInstanceResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'backupInstanceName': self._serialize.url("backup_instance_name", backup_instance_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BackupInstanceResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'BackupInstanceResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200, 201, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize('BackupInstanceResource', pipeline_response) if response.status_code == 201: deserialized = self._deserialize('BackupInstanceResource', pipeline_response) + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}"} # type: ignore + + + @distributed_trace def begin_create_or_update( self, - vault_name, # type: str - resource_group_name, # type: str - backup_instance_name, # type: str - parameters, # type: "_models.BackupInstanceResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.BackupInstanceResource"] + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: "_models.BackupInstanceResource", + **kwargs: Any + ) -> LROPoller["_models.BackupInstanceResource"]: """Create or update a backup instance in a backup vault. - :param vault_name: The name of the backup vault. - :type vault_name: str :param resource_group_name: The name of the resource group where the backup vault is present. :type resource_group_name: str + :param vault_name: The name of the backup vault. + :type vault_name: str :param backup_instance_name: The name of the backup instance. :type backup_instance_name: str :param parameters: Request body for operation. :type parameters: ~azure.mgmt.dataprotection.models.BackupInstanceResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either BackupInstanceResource or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BackupInstanceResource or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.BackupInstanceResource] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupInstanceResource"] lro_delay = kwargs.pop( @@ -283,32 +926,26 @@ def begin_create_or_update( cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( - vault_name=vault_name, resource_group_name=resource_group_name, + vault_name=vault_name, backup_instance_name=backup_instance_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BackupInstanceResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'backupInstanceName': self._serialize.url("backup_instance_name", backup_instance_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -318,46 +955,42 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - vault_name, # type: str - resource_group_name, # type: str - backup_instance_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'backupInstanceName': self._serialize.url("backup_instance_name", backup_instance_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-04-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -369,38 +1002,43 @@ def _delete_initial( response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}"} # type: ignore + - def begin_delete( + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements self, - vault_name, # type: str - resource_group_name, # type: str - backup_instance_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a backup instance in a backup vault. - :param vault_name: The name of the backup vault. - :type vault_name: str :param resource_group_name: The name of the resource group where the backup vault is present. :type resource_group_name: str + :param vault_name: The name of the backup vault. + :type vault_name: str :param backup_instance_name: The name of the backup instance. :type backup_instance_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -410,28 +1048,21 @@ def begin_delete( cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( - vault_name=vault_name, resource_group_name=resource_group_name, + vault_name=vault_name, backup_instance_name=backup_instance_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'backupInstanceName': self._serialize.url("backup_instance_name", backup_instance_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -441,60 +1072,55 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}"} # type: ignore def _adhoc_backup_initial( self, - vault_name, # type: str - resource_group_name, # type: str - backup_instance_name, # type: str - parameters, # type: "_models.TriggerBackupRequest" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationJobExtendedInfo"] + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: "_models.TriggerBackupRequest", + **kwargs: Any + ) -> Optional["_models.OperationJobExtendedInfo"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationJobExtendedInfo"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._adhoc_backup_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'backupInstanceName': self._serialize.url("backup_instance_name", backup_instance_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'TriggerBackupRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'TriggerBackupRequest') + + request = build_adhoc_backup_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._adhoc_backup_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize('OperationJobExtendedInfo', pipeline_response) @@ -502,42 +1128,51 @@ def _adhoc_backup_initial( response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _adhoc_backup_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/backup'} # type: ignore + _adhoc_backup_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/backup"} # type: ignore + + + @distributed_trace def begin_adhoc_backup( self, - vault_name, # type: str - resource_group_name, # type: str - backup_instance_name, # type: str - parameters, # type: "_models.TriggerBackupRequest" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationJobExtendedInfo"] + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: "_models.TriggerBackupRequest", + **kwargs: Any + ) -> LROPoller["_models.OperationJobExtendedInfo"]: """Trigger adhoc backup. - :param vault_name: The name of the backup vault. - :type vault_name: str :param resource_group_name: The name of the resource group where the backup vault is present. :type resource_group_name: str + :param vault_name: The name of the backup vault. + :type vault_name: str :param backup_instance_name: The name of the backup instance. :type backup_instance_name: str :param parameters: Request body for operation. :type parameters: ~azure.mgmt.dataprotection.models.TriggerBackupRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationJobExtendedInfo or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OperationJobExtendedInfo or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationJobExtendedInfo"] lro_delay = kwargs.pop( @@ -547,32 +1182,26 @@ def begin_adhoc_backup( cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._adhoc_backup_initial( - vault_name=vault_name, resource_group_name=resource_group_name, + vault_name=vault_name, backup_instance_name=backup_instance_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationJobExtendedInfo', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'backupInstanceName': self._serialize.url("backup_instance_name", backup_instance_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -582,58 +1211,53 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_adhoc_backup.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/backup'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_adhoc_backup.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/backup"} # type: ignore def _validate_for_backup_initial( self, - vault_name, # type: str - resource_group_name, # type: str - parameters, # type: "_models.ValidateForBackupRequest" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationJobExtendedInfo"] + resource_group_name: str, + vault_name: str, + parameters: "_models.ValidateForBackupRequest", + **kwargs: Any + ) -> Optional["_models.OperationJobExtendedInfo"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationJobExtendedInfo"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._validate_for_backup_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ValidateForBackupRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ValidateForBackupRequest') + + request = build_validate_for_backup_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._validate_for_backup_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize('OperationJobExtendedInfo', pipeline_response) @@ -641,39 +1265,48 @@ def _validate_for_backup_initial( response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _validate_for_backup_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/validateForBackup'} # type: ignore + _validate_for_backup_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/validateForBackup"} # type: ignore + + + @distributed_trace def begin_validate_for_backup( self, - vault_name, # type: str - resource_group_name, # type: str - parameters, # type: "_models.ValidateForBackupRequest" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationJobExtendedInfo"] + resource_group_name: str, + vault_name: str, + parameters: "_models.ValidateForBackupRequest", + **kwargs: Any + ) -> LROPoller["_models.OperationJobExtendedInfo"]: """Validate whether adhoc backup will be successful or not. - :param vault_name: The name of the backup vault. - :type vault_name: str :param resource_group_name: The name of the resource group where the backup vault is present. :type resource_group_name: str + :param vault_name: The name of the backup vault. + :type vault_name: str :param parameters: Request body for operation. :type parameters: ~azure.mgmt.dataprotection.models.ValidateForBackupRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationJobExtendedInfo or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OperationJobExtendedInfo or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationJobExtendedInfo"] lro_delay = kwargs.pop( @@ -683,30 +1316,25 @@ def begin_validate_for_backup( cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._validate_for_backup_initial( - vault_name=vault_name, resource_group_name=resource_group_name, + vault_name=vault_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationJobExtendedInfo', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -716,52 +1344,115 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_validate_for_backup.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/validateForBackup'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_validate_for_backup.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/validateForBackup"} # type: ignore - def _trigger_rehydrate_initial( + @distributed_trace + def get_backup_instance_operation_result( self, - resource_group_name, # type: str - vault_name, # type: str - backup_instance_name, # type: str - parameters, # type: "_models.AzureBackupRehydrationRequest" - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + operation_id: str, + **kwargs: Any + ) -> Optional["_models.BackupInstanceResource"]: + """Get result of backup instance creation operation. + + :param resource_group_name: The name of the resource group where the backup vault is present. + :type resource_group_name: str + :param vault_name: The name of the backup vault. + :type vault_name: str + :param backup_instance_name: + :type backup_instance_name: str + :param operation_id: + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupInstanceResource, or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.BackupInstanceResource or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.BackupInstanceResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._trigger_rehydrate_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'backupInstanceName': self._serialize.url("backup_instance_name", backup_instance_name, 'str'), + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_backup_instance_operation_result_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + operation_id=operation_id, + api_version=api_version, + template_url=self.get_backup_instance_operation_result.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('BackupInstanceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_backup_instance_operation_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/operationResults/{operationId}"} # type: ignore + + + def _trigger_rehydrate_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: "_models.AzureBackupRehydrationRequest", + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'AzureBackupRehydrationRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'AzureBackupRehydrationRequest') + + request = build_trigger_rehydrate_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._trigger_rehydrate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -773,21 +1464,23 @@ def _trigger_rehydrate_initial( response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _trigger_rehydrate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/rehydrate'} # type: ignore + _trigger_rehydrate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/rehydrate"} # type: ignore - def begin_trigger_rehydrate( + + @distributed_trace + def begin_trigger_rehydrate( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - vault_name, # type: str - backup_instance_name, # type: str - parameters, # type: "_models.AzureBackupRehydrationRequest" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: "_models.AzureBackupRehydrationRequest", + **kwargs: Any + ) -> LROPoller[None]: """rehydrate recovery point for restore for a BackupInstance. :param resource_group_name: The name of the resource group where the backup vault is present. @@ -800,14 +1493,18 @@ def begin_trigger_rehydrate( :type parameters: ~azure.mgmt.dataprotection.models.AzureBackupRehydrationRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -821,25 +1518,19 @@ def begin_trigger_rehydrate( vault_name=vault_name, backup_instance_name=backup_instance_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'backupInstanceName': self._serialize.url("backup_instance_name", backup_instance_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -849,60 +1540,55 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_trigger_rehydrate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/rehydrate'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_trigger_rehydrate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/rehydrate"} # type: ignore def _trigger_restore_initial( self, - vault_name, # type: str - resource_group_name, # type: str - backup_instance_name, # type: str - parameters, # type: "_models.AzureBackupRestoreRequest" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationJobExtendedInfo"] + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: "_models.AzureBackupRestoreRequest", + **kwargs: Any + ) -> Optional["_models.OperationJobExtendedInfo"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationJobExtendedInfo"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._trigger_restore_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'backupInstanceName': self._serialize.url("backup_instance_name", backup_instance_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'AzureBackupRestoreRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'AzureBackupRestoreRequest') + + request = build_trigger_restore_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._trigger_restore_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize('OperationJobExtendedInfo', pipeline_response) @@ -910,42 +1596,51 @@ def _trigger_restore_initial( response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _trigger_restore_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/restore'} # type: ignore + _trigger_restore_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/restore"} # type: ignore + + + @distributed_trace def begin_trigger_restore( self, - vault_name, # type: str - resource_group_name, # type: str - backup_instance_name, # type: str - parameters, # type: "_models.AzureBackupRestoreRequest" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationJobExtendedInfo"] + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: "_models.AzureBackupRestoreRequest", + **kwargs: Any + ) -> LROPoller["_models.OperationJobExtendedInfo"]: """Triggers restore for a BackupInstance. - :param vault_name: The name of the backup vault. - :type vault_name: str :param resource_group_name: The name of the resource group where the backup vault is present. :type resource_group_name: str + :param vault_name: The name of the backup vault. + :type vault_name: str :param backup_instance_name: The name of the backup instance. :type backup_instance_name: str :param parameters: Request body for operation. :type parameters: ~azure.mgmt.dataprotection.models.AzureBackupRestoreRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationJobExtendedInfo or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OperationJobExtendedInfo or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationJobExtendedInfo"] lro_delay = kwargs.pop( @@ -955,32 +1650,26 @@ def begin_trigger_restore( cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._trigger_restore_initial( - vault_name=vault_name, resource_group_name=resource_group_name, + vault_name=vault_name, backup_instance_name=backup_instance_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationJobExtendedInfo', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'backupInstanceName': self._serialize.url("backup_instance_name", backup_instance_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -990,52 +1679,42 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_trigger_restore.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/restore'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _validate_for_restore_initial( + begin_trigger_restore.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/restore"} # type: ignore + + def _resume_backups_initial( # pylint: disable=inconsistent-return-statements self, - vault_name, # type: str - resource_group_name, # type: str - backup_instance_name, # type: str - parameters, # type: "_models.ValidateRestoreRequestObject" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationJobExtendedInfo"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationJobExtendedInfo"]] + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._validate_for_restore_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'backupInstanceName': self._serialize.url("backup_instance_name", backup_instance_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ValidateRestoreRequestObject') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_resume_backups_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + api_version=api_version, + template_url=self._resume_backups_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1043,85 +1722,71 @@ def _validate_for_restore_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('OperationJobExtendedInfo', pipeline_response) - if response.status_code == 202: response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, None, response_headers) - return deserialized - _validate_for_restore_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/validateRestore'} # type: ignore + _resume_backups_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/resumeBackups"} # type: ignore - def begin_validate_for_restore( + + @distributed_trace + def begin_resume_backups( # pylint: disable=inconsistent-return-statements self, - vault_name, # type: str - resource_group_name, # type: str - backup_instance_name, # type: str - parameters, # type: "_models.ValidateRestoreRequestObject" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationJobExtendedInfo"] - """Validates if Restore can be triggered for a DataSource. + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """This operation will resume backups for backup instance. - :param vault_name: The name of the backup vault. - :type vault_name: str :param resource_group_name: The name of the resource group where the backup vault is present. :type resource_group_name: str - :param backup_instance_name: The name of the backup instance. + :param vault_name: The name of the backup vault. + :type vault_name: str + :param backup_instance_name: :type backup_instance_name: str - :param parameters: Request body for operation. - :type parameters: ~azure.mgmt.dataprotection.models.ValidateRestoreRequestObject :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationJobExtendedInfo or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationJobExtendedInfo"] + cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._validate_for_restore_initial( - vault_name=vault_name, + raw_result = self._resume_backups_initial( resource_group_name=resource_group_name, + vault_name=vault_name, backup_instance_name=backup_instance_name, - parameters=parameters, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('OperationJobExtendedInfo', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized + return cls(pipeline_response, None, {}) - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'backupInstanceName': self._serialize.url("backup_instance_name", backup_instance_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1131,6 +1796,625 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_validate_for_restore.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/validateRestore'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_resume_backups.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/resumeBackups"} # type: ignore + + def _resume_protection_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_resume_protection_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + api_version=api_version, + template_url=self._resume_protection_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + + if cls: + return cls(pipeline_response, None, response_headers) + + _resume_protection_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/resumeProtection"} # type: ignore + + + @distributed_trace + def begin_resume_protection( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """This operation will resume protection for a stopped backup instance. + + :param resource_group_name: The name of the resource group where the backup vault is present. + :type resource_group_name: str + :param vault_name: The name of the backup vault. + :type vault_name: str + :param backup_instance_name: + :type backup_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._resume_protection_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_resume_protection.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/resumeProtection"} # type: ignore + + def _stop_protection_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_stop_protection_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + api_version=api_version, + template_url=self._stop_protection_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + + if cls: + return cls(pipeline_response, None, response_headers) + + _stop_protection_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/stopProtection"} # type: ignore + + + @distributed_trace + def begin_stop_protection( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """This operation will stop protection of a backup instance and data will be held forever. + + :param resource_group_name: The name of the resource group where the backup vault is present. + :type resource_group_name: str + :param vault_name: The name of the backup vault. + :type vault_name: str + :param backup_instance_name: + :type backup_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._stop_protection_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_stop_protection.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/stopProtection"} # type: ignore + + def _suspend_backups_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_suspend_backups_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + api_version=api_version, + template_url=self._suspend_backups_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + + if cls: + return cls(pipeline_response, None, response_headers) + + _suspend_backups_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/suspendBackups"} # type: ignore + + + @distributed_trace + def begin_suspend_backups( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """This operation will stop backups for backup instance. + + :param resource_group_name: The name of the resource group where the backup vault is present. + :type resource_group_name: str + :param vault_name: The name of the backup vault. + :type vault_name: str + :param backup_instance_name: + :type backup_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._suspend_backups_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_suspend_backups.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/suspendBackups"} # type: ignore + + def _sync_backup_instance_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: "_models.SyncBackupInstanceRequest", + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'SyncBackupInstanceRequest') + + request = build_sync_backup_instance_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._sync_backup_instance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + + if cls: + return cls(pipeline_response, None, response_headers) + + _sync_backup_instance_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/sync"} # type: ignore + + + @distributed_trace + def begin_sync_backup_instance( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: "_models.SyncBackupInstanceRequest", + **kwargs: Any + ) -> LROPoller[None]: + """Sync backup instance again in case of failure + This action will retry last failed operation and will bring backup instance to valid state. + + :param resource_group_name: The name of the resource group where the backup vault is present. + :type resource_group_name: str + :param vault_name: The name of the backup vault. + :type vault_name: str + :param backup_instance_name: + :type backup_instance_name: str + :param parameters: Request body for operation. + :type parameters: ~azure.mgmt.dataprotection.models.SyncBackupInstanceRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._sync_backup_instance_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_sync_backup_instance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/sync"} # type: ignore + + def _validate_for_restore_initial( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: "_models.ValidateRestoreRequestObject", + **kwargs: Any + ) -> Optional["_models.OperationJobExtendedInfo"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationJobExtendedInfo"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ValidateRestoreRequestObject') + + request = build_validate_for_restore_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._validate_for_restore_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize('OperationJobExtendedInfo', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _validate_for_restore_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/validateRestore"} # type: ignore + + + @distributed_trace + def begin_validate_for_restore( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: "_models.ValidateRestoreRequestObject", + **kwargs: Any + ) -> LROPoller["_models.OperationJobExtendedInfo"]: + """Validates if Restore can be triggered for a DataSource. + + :param resource_group_name: The name of the resource group where the backup vault is present. + :type resource_group_name: str + :param vault_name: The name of the backup vault. + :type vault_name: str + :param backup_instance_name: The name of the backup instance. + :type backup_instance_name: str + :param parameters: Request body for operation. + :type parameters: ~azure.mgmt.dataprotection.models.ValidateRestoreRequestObject + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OperationJobExtendedInfo or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationJobExtendedInfo"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._validate_for_restore_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('OperationJobExtendedInfo', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_validate_for_restore.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/validateRestore"} # type: ignore 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 66ec3395e92e..dde6f53c7be7 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_policies_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_policies_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,183 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies") # 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'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + backup_policy_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}") # 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'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "backupPolicyName": _SERIALIZER.url("backup_policy_name", backup_policy_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + backup_policy_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}") # 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'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "backupPolicyName": _SERIALIZER.url("backup_policy_name", backup_policy_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + backup_policy_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}") # 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'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "backupPolicyName": _SERIALIZER.url("backup_policy_name", backup_policy_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class BackupPoliciesOperations(object): """BackupPoliciesOperations operations. @@ -45,59 +206,62 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - vault_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.BaseBackupPolicyResourceList"] + resource_group_name: str, + vault_name: str, + **kwargs: Any + ) -> Iterable["_models.BaseBackupPolicyResourceList"]: """Returns list of backup policies belonging to a backup vault. - :param vault_name: The name of the backup vault. - :type vault_name: str :param resource_group_name: The name of the resource group where the backup vault is present. :type resource_group_name: str + :param vault_name: The name of the backup vault. + :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 BaseBackupPolicyResourceList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.BaseBackupPolicyResourceList] + :return: An iterator like instance of either BaseBackupPolicyResourceList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.BaseBackupPolicyResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.BaseBackupPolicyResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + api_version=api_version, + template_url=next_link, + ) + 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('BaseBackupPolicyResourceList', pipeline_response) + deserialized = self._deserialize("BaseBackupPolicyResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -106,7 +270,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -115,27 +283,28 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies"} # type: ignore + @distributed_trace def get( self, - vault_name, # type: str - resource_group_name, # type: str - backup_policy_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BaseBackupPolicyResource" + resource_group_name: str, + vault_name: str, + backup_policy_name: str, + **kwargs: Any + ) -> "_models.BaseBackupPolicyResource": """Gets a backup policy belonging to a backup vault. Gets a backup policy belonging to a backup vault. - :param vault_name: The name of the backup vault. - :type vault_name: str :param resource_group_name: The name of the resource group where the backup vault is present. :type resource_group_name: str + :param vault_name: The name of the backup vault. + :type vault_name: str :param backup_policy_name: :type backup_policy_name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -148,29 +317,26 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'backupPolicyName': self._serialize.url("backup_policy_name", backup_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-04-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_policy_name=backup_policy_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -183,25 +349,27 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}"} # type: ignore + + + @distributed_trace def create_or_update( self, - vault_name, # type: str - resource_group_name, # type: str - backup_policy_name, # type: str - parameters, # type: "_models.BaseBackupPolicyResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.BaseBackupPolicyResource" + resource_group_name: str, + vault_name: str, + backup_policy_name: str, + parameters: "_models.BaseBackupPolicyResource", + **kwargs: Any + ) -> "_models.BaseBackupPolicyResource": """Creates or Updates a backup policy belonging to a backup vault. Creates or Updates a backup policy belonging to a backup vault. - :param vault_name: The name of the backup vault. - :type vault_name: str :param resource_group_name: The name of the resource group where the backup vault is present. :type resource_group_name: str + :param vault_name: The name of the backup vault. + :type vault_name: str :param backup_policy_name: Name of the policy. :type backup_policy_name: str :param parameters: Request body for operation. @@ -216,34 +384,30 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'backupPolicyName': self._serialize.url("backup_policy_name", backup_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BaseBackupPolicyResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'BaseBackupPolicyResource') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_policy_name=backup_policy_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -256,24 +420,26 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}'} # type: ignore - def delete( + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}"} # type: ignore + + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements self, - vault_name, # type: str - resource_group_name, # type: str - backup_policy_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vault_name: str, + backup_policy_name: str, + **kwargs: Any + ) -> None: """Deletes a backup policy belonging to a backup vault. Deletes a backup policy belonging to a backup vault. - :param vault_name: The name of the backup vault. - :type vault_name: str :param resource_group_name: The name of the resource group where the backup vault is present. :type resource_group_name: str + :param vault_name: The name of the backup vault. + :type vault_name: str :param backup_policy_name: :type backup_policy_name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -286,29 +452,26 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'backupPolicyName': self._serialize.url("backup_policy_name", backup_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-04-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_policy_name=backup_policy_name, + api_version=api_version, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -318,4 +481,5 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}"} # type: ignore + 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 a04e8c5e27a8..4922c11d48bb 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_vault_operation_results_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_vault_operation_results_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,22 +6,61 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + operation_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/operationResults/{operationId}") # 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'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class BackupVaultOperationResultsOperations(object): """BackupVaultOperationResultsOperations operations. @@ -44,20 +84,20 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - vault_name, # type: str - resource_group_name, # type: str - operation_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.BackupVaultResource"] + resource_group_name: str, + vault_name: str, + operation_id: str, + **kwargs: Any + ) -> Optional["_models.BackupVaultResource"]: """get. - :param vault_name: The name of the backup vault. - :type vault_name: str :param resource_group_name: The name of the resource group where the backup vault is present. :type resource_group_name: str + :param vault_name: The name of the backup vault. + :type vault_name: str :param operation_id: :type operation_id: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -70,37 +110,34 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + operation_id=operation_id, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize('BackupVaultResource', pipeline_response) @@ -108,9 +145,12 @@ def get( response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/operationResults/{operationId}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/operationResults/{operationId}"} # type: ignore + 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 d7894a30a873..579fb9b05717 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_vaults_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_vaults_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,25 +6,297 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_in_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/backupVaults") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_in_resource_group_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}") # 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'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + vault_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}") # 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'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}") # 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'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + vault_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}") # 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'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_check_name_availability_request( + resource_group_name: str, + subscription_id: str, + location: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/locations/{location}/checkNameAvailability") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) class BackupVaultsOperations(object): """BackupVaultsOperations operations. @@ -47,51 +320,51 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get_in_subscription( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.BackupVaultResourceList"] + **kwargs: Any + ) -> Iterable["_models.BackupVaultResourceList"]: """Returns resource collection belonging to a subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BackupVaultResourceList or the result of cls(response) + :return: An iterator like instance of either BackupVaultResourceList or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.BackupVaultResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupVaultResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.get_in_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_in_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_in_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_in_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + 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('BackupVaultResourceList', pipeline_response) + deserialized = self._deserialize("BackupVaultResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -100,7 +373,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -109,60 +386,62 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - get_in_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/backupVaults'} # type: ignore + get_in_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/backupVaults"} # type: ignore + @distributed_trace def get_in_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.BackupVaultResourceList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.BackupVaultResourceList"]: """Returns resource collection belonging to a resource group. :param resource_group_name: The name of the resource group where the backup vault is present. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BackupVaultResourceList or the result of cls(response) + :return: An iterator like instance of either BackupVaultResourceList or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.BackupVaultResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupVaultResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.get_in_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_in_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_in_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_in_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + 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('BackupVaultResourceList', pipeline_response) + deserialized = self._deserialize("BackupVaultResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -171,7 +450,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -180,24 +463,25 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - get_in_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults'} # type: ignore + get_in_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults"} # type: ignore + @distributed_trace def get( self, - vault_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BackupVaultResource" + resource_group_name: str, + vault_name: str, + **kwargs: Any + ) -> "_models.BackupVaultResource": """Returns a resource belonging to a resource group. - :param vault_name: The name of the backup vault. - :type vault_name: str :param resource_group_name: The name of the resource group where the backup vault is present. :type resource_group_name: str + :param vault_name: The name of the backup vault. + :type vault_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: BackupVaultResource, or the result of cls(response) :rtype: ~azure.mgmt.dataprotection.models.BackupVaultResource @@ -208,28 +492,25 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-04-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -242,48 +523,45 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}"} # type: ignore + def _create_or_update_initial( self, - vault_name, # type: str - resource_group_name, # type: str - parameters, # type: "_models.BackupVaultResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.BackupVaultResource" + resource_group_name: str, + vault_name: str, + parameters: "_models.BackupVaultResource", + **kwargs: Any + ) -> "_models.BackupVaultResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupVaultResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BackupVaultResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'BackupVaultResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -300,34 +578,41 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}"} # type: ignore + + + @distributed_trace def begin_create_or_update( self, - vault_name, # type: str - resource_group_name, # type: str - parameters, # type: "_models.BackupVaultResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.BackupVaultResource"] + resource_group_name: str, + vault_name: str, + parameters: "_models.BackupVaultResource", + **kwargs: Any + ) -> LROPoller["_models.BackupVaultResource"]: """Creates or updates a BackupVault resource belonging to a resource group. - :param vault_name: The name of the backup vault. - :type vault_name: str :param resource_group_name: The name of the resource group where the backup vault is present. :type resource_group_name: str + :param vault_name: The name of the backup vault. + :type vault_name: str :param parameters: Request body for operation. :type parameters: ~azure.mgmt.dataprotection.models.BackupVaultResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either BackupVaultResource or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BackupVaultResource or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.BackupVaultResource] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupVaultResource"] lro_delay = kwargs.pop( @@ -337,30 +622,25 @@ def begin_create_or_update( cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( - vault_name=vault_name, resource_group_name=resource_group_name, + vault_name=vault_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BackupVaultResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -370,23 +650,23 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def delete( + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}"} # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements self, - vault_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vault_name: str, + **kwargs: Any + ) -> None: """Deletes a BackupVault resource from the resource group. - :param vault_name: The name of the backup vault. - :type vault_name: str :param resource_group_name: The name of the resource group where the backup vault is present. :type resource_group_name: str + :param vault_name: The name of the backup vault. + :type vault_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 @@ -397,28 +677,25 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-04-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + api_version=api_version, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -428,48 +705,44 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}"} # type: ignore + def _update_initial( self, - vault_name, # type: str - resource_group_name, # type: str - parameters, # type: "_models.PatchResourceRequestInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.BackupVaultResource"] + resource_group_name: str, + vault_name: str, + parameters: "_models.PatchResourceRequestInput", + **kwargs: Any + ) -> Optional["_models.BackupVaultResource"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.BackupVaultResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'PatchResourceRequestInput') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'PatchResourceRequestInput') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -484,35 +757,42 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}"} # type: ignore + + + @distributed_trace def begin_update( self, - vault_name, # type: str - resource_group_name, # type: str - parameters, # type: "_models.PatchResourceRequestInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.BackupVaultResource"] + resource_group_name: str, + vault_name: str, + parameters: "_models.PatchResourceRequestInput", + **kwargs: Any + ) -> LROPoller["_models.BackupVaultResource"]: """Updates a BackupVault resource belonging to a resource group. For example, updating tags for a resource. - :param vault_name: The name of the backup vault. - :type vault_name: str :param resource_group_name: The name of the resource group where the backup vault is present. :type resource_group_name: str + :param vault_name: The name of the backup vault. + :type vault_name: str :param parameters: Request body for operation. :type parameters: ~azure.mgmt.dataprotection.models.PatchResourceRequestInput :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either BackupVaultResource or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BackupVaultResource or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.BackupVaultResource] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupVaultResource"] lro_delay = kwargs.pop( @@ -522,30 +802,25 @@ def begin_update( cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._update_initial( - vault_name=vault_name, resource_group_name=resource_group_name, + vault_name=vault_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BackupVaultResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -555,18 +830,18 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}"} # type: ignore + + @distributed_trace def check_name_availability( self, - resource_group_name, # type: str - location, # type: str - parameters, # type: "_models.CheckNameAvailabilityRequest" - **kwargs # type: Any - ): - # type: (...) -> "_models.CheckNameAvailabilityResult" + resource_group_name: str, + location: str, + parameters: "_models.CheckNameAvailabilityRequest", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityResult": """API to check for resource name availability. API to check for resource name availability. @@ -587,33 +862,29 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CheckNameAvailabilityRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'CheckNameAvailabilityRequest') + + request = build_check_name_availability_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + location=location, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -626,4 +897,6 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/locations/{location}/checkNameAvailability'} # type: ignore + + check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/locations/{location}/checkNameAvailability"} # type: ignore + diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_data_protection_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_data_protection_operations.py index 47420332c4c3..43b28102e8f4 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_data_protection_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_data_protection_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,22 +6,66 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_check_feature_support_request( + subscription_id: str, + location: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/locations/{location}/checkFeatureSupport") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) class DataProtectionOperations(object): """DataProtectionOperations operations. @@ -44,13 +89,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def check_feature_support( self, - location, # type: str - parameters, # type: "_models.FeatureValidationRequestBase" - **kwargs # type: Any - ): - # type: (...) -> "_models.FeatureValidationResponseBase" + location: str, + parameters: "_models.FeatureValidationRequestBase", + **kwargs: Any + ) -> "_models.FeatureValidationResponseBase": """Validates if a feature is supported. Validates if a feature is supported. @@ -69,32 +114,28 @@ def check_feature_support( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_feature_support.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'FeatureValidationRequestBase') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'FeatureValidationRequestBase') + + request = build_check_feature_support_request( + subscription_id=self._config.subscription_id, + location=location, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.check_feature_support.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -107,4 +148,6 @@ def check_feature_support( return cls(pipeline_response, deserialized, {}) return deserialized - check_feature_support.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/locations/{location}/checkFeatureSupport'} # type: ignore + + check_feature_support.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/locations/{location}/checkFeatureSupport"} # type: ignore + diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_data_protection_operations_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_data_protection_operations_operations.py index aa0b0343c117..52bc1e5d9eb0 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_data_protection_operations_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_data_protection_operations_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,50 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.DataProtection/operations") + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class DataProtectionOperationsOperations(object): """DataProtectionOperationsOperations operations. @@ -45,47 +73,49 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ClientDiscoveryResponse"] + **kwargs: Any + ) -> Iterable["_models.ClientDiscoveryResponse"]: """Returns the list of available operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ClientDiscoveryResponse or the result of cls(response) + :return: An iterator like instance of either ClientDiscoveryResponse or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.ClientDiscoveryResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ClientDiscoveryResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + api_version=api_version, + template_url=next_link, + ) + 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('ClientDiscoveryResponse', pipeline_response) + deserialized = self._deserialize("ClientDiscoveryResponse", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -94,7 +124,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -103,7 +137,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.DataProtection/operations'} # type: ignore + list.metadata = {'url': "/providers/Microsoft.DataProtection/operations"} # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_export_jobs_operation_result_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_export_jobs_operation_result_operations.py index a22827dafd75..eca5c5f83c6f 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_export_jobs_operation_result_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_export_jobs_operation_result_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,22 +6,61 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + operation_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs/operations/{operationId}") # 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'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class ExportJobsOperationResultOperations(object): """ExportJobsOperationResultOperations operations. @@ -44,14 +84,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - vault_name, # type: str - operation_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.ExportJobsResult"] + resource_group_name: str, + vault_name: str, + operation_id: str, + **kwargs: Any + ) -> Optional["_models.ExportJobsResult"]: """Gets the operation result of operation triggered by Export Jobs API. If the operation is successful, then it also contains URL of a Blob and a SAS key to access the same. The blob contains exported jobs in JSON serialized format. @@ -72,29 +112,26 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + operation_id=operation_id, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -109,4 +146,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs/operations/{operationId}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs/operations/{operationId}"} # type: ignore + diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_export_jobs_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_export_jobs_operations.py index 9fd4f08a874e..03dfba2999ed 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_export_jobs_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_export_jobs_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,24 +6,61 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_trigger_request_initial( + subscription_id: str, + resource_group_name: str, + vault_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/exportBackupJobs") # 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'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class ExportJobsOperations(object): """ExportJobsOperations operations. @@ -46,40 +84,36 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - def _trigger_initial( + def _trigger_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - vault_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vault_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self._trigger_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-04-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_trigger_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + api_version=api_version, + template_url=self._trigger_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -90,19 +124,21 @@ def _trigger_initial( if response.status_code == 202: response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _trigger_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/exportBackupJobs'} # type: ignore + _trigger_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/exportBackupJobs"} # type: ignore + - def begin_trigger( + @distributed_trace + def begin_trigger( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - vault_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vault_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Triggers export of jobs and returns an OperationID to track. :param resource_group_name: The name of the resource group where the backup vault is present. @@ -111,14 +147,17 @@ def begin_trigger( :type vault_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -130,24 +169,18 @@ def begin_trigger( raw_result = self._trigger_initial( resource_group_name=resource_group_name, vault_name=vault_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -157,6 +190,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_trigger.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/exportBackupJobs'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_trigger.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/exportBackupJobs"} # type: ignore 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 1e7e0d74d189..6190fe964171 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_jobs_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_jobs_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,98 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +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( + subscription_id: str, + resource_group_name: str, + vault_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs") # 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'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + job_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs/{jobId}") # 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'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "jobId": _SERIALIZER.url("job_id", job_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class JobsOperations(object): """JobsOperations operations. @@ -45,13 +121,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - vault_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AzureBackupJobResourceList"] + resource_group_name: str, + vault_name: str, + **kwargs: Any + ) -> Iterable["_models.AzureBackupJobResourceList"]: """Returns list of jobs belonging to a backup vault. :param resource_group_name: The name of the resource group where the backup vault is present. @@ -59,45 +135,48 @@ def list( :param vault_name: The name of the backup vault. :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 AzureBackupJobResourceList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.AzureBackupJobResourceList] + :return: An iterator like instance of either AzureBackupJobResourceList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.AzureBackupJobResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AzureBackupJobResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AzureBackupJobResourceList', pipeline_response) + deserialized = self._deserialize("AzureBackupJobResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -106,7 +185,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -115,19 +198,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs"} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - vault_name, # type: str - job_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.AzureBackupJobResource" + resource_group_name: str, + vault_name: str, + job_id: str, + **kwargs: Any + ) -> "_models.AzureBackupJobResource": """Gets a job with id in a backup vault. :param resource_group_name: The name of the resource group where the backup vault is present. @@ -147,29 +231,26 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'jobId': self._serialize.url("job_id", job_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-04-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + job_id=job_id, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -182,4 +263,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs/{jobId}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs/{jobId}"} # type: ignore + diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_result_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_result_operations.py index cd2604a8468c..d4889ce7ee3f 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_result_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_result_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,22 +6,59 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + operation_id: str, + location: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/locations/{location}/operationResults/{operationId}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class OperationResultOperations(object): """OperationResultOperations operations. @@ -44,13 +82,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - operation_id, # type: str - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationJobExtendedInfo"] + operation_id: str, + location: str, + **kwargs: Any + ) -> Optional["_models.OperationJobExtendedInfo"]: """Gets the operation status for a resource. Gets the operation result for a resource. @@ -69,36 +107,33 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + operation_id=operation_id, + location=location, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize('OperationJobExtendedInfo', pipeline_response) @@ -106,9 +141,12 @@ def get( response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/locations/{location}/operationResults/{operationId}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/locations/{location}/operationResults/{operationId}"} # type: ignore + 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 new file mode 100644 index 000000000000..ca977e5e8d9d --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_status_backup_vault_context_operations.py @@ -0,0 +1,149 @@ +# 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, Optional, TypeVar + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + operation_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/operationStatus/{operationId}") # 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'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +class OperationStatusBackupVaultContextOperations(object): + """OperationStatusBackupVaultContextOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.dataprotection.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + resource_group_name: str, + vault_name: str, + operation_id: str, + **kwargs: Any + ) -> "_models.OperationResource": + """Gets the operation status for an operation over a BackupVault's context. + + Gets the operation status for an operation over a BackupVault's context. + + :param resource_group_name: The name of the resource group where the backup vault is present. + :type resource_group_name: str + :param vault_name: The name of the backup vault. + :type vault_name: str + :param operation_id: + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OperationResource, or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.OperationResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + operation_id=operation_id, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **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('OperationResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/operationStatus/{operationId}"} # type: ignore + diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_status_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_status_operations.py index 0bc8bf9eacab..dfb64927b773 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_status_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_status_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,22 +6,59 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + location: str, + operation_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/locations/{location}/operationStatus/{operationId}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class OperationStatusOperations(object): """OperationStatusOperations operations. @@ -44,13 +82,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - location, # type: str - operation_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.OperationResource" + location: str, + operation_id: str, + **kwargs: Any + ) -> "_models.OperationResource": """Gets the operation status for a resource. Gets the operation status for a resource. @@ -69,28 +107,25 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + location=location, + operation_id=operation_id, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -103,4 +138,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/locations/{location}/operationStatus/{operationId}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/locations/{location}/operationStatus/{operationId}"} # type: ignore + diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_status_resource_group_context_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_status_resource_group_context_operations.py new file mode 100644 index 000000000000..a703ef34706d --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_status_resource_group_context_operations.py @@ -0,0 +1,143 @@ +# 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, Optional, TypeVar + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + resource_group_name: str, + subscription_id: str, + operation_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/operationStatus/{operationId}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +class OperationStatusResourceGroupContextOperations(object): + """OperationStatusResourceGroupContextOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.dataprotection.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + resource_group_name: str, + operation_id: str, + **kwargs: Any + ) -> "_models.OperationResource": + """Gets the operation status for an operation over a ResourceGroup's context. + + Gets the operation status for an operation over a ResourceGroup's context. + + :param resource_group_name: The name of the resource group where the backup vault is present. + :type resource_group_name: str + :param operation_id: + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OperationResource, or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.OperationResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + operation_id=operation_id, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **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('OperationResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/operationStatus/{operationId}"} # type: ignore + diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_recovery_points_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_recovery_points_operations.py index 935b39fd586f..ff7592f603dc 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_recovery_points_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_recovery_points_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,109 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +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( + subscription_id: str, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + *, + filter: Optional[str] = None, + skip_token: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/recoveryPoints") # 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'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if skip_token is not None: + _query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +def build_get_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + recovery_point_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/recoveryPoints/{recoveryPointId}") # 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'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, 'str'), + "recoveryPointId": _SERIALIZER.url("recovery_point_id", recovery_point_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class RecoveryPointsOperations(object): """RecoveryPointsOperations operations. @@ -45,73 +132,77 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - vault_name, # type: str - resource_group_name, # type: str - backup_instance_name, # type: str - filter=None, # type: Optional[str] - skip_token=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AzureBackupRecoveryPointResourceList"] + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + filter: Optional[str] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.AzureBackupRecoveryPointResourceList"]: """Returns a list of Recovery Points for a DataSource in a vault. - :param vault_name: The name of the backup vault. - :type vault_name: str :param resource_group_name: The name of the resource group where the backup vault is present. :type resource_group_name: str + :param vault_name: The name of the backup vault. + :type vault_name: str :param backup_instance_name: The name of the backup instance. :type backup_instance_name: str - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str - :param skip_token: skipToken Filter. + :param skip_token: skipToken Filter. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AzureBackupRecoveryPointResourceList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.AzureBackupRecoveryPointResourceList] + :return: An iterator like instance of either AzureBackupRecoveryPointResourceList or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.AzureBackupRecoveryPointResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AzureBackupRecoveryPointResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'backupInstanceName': self._serialize.url("backup_instance_name", backup_instance_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + api_version=api_version, + filter=filter, + skip_token=skip_token, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + api_version=api_version, + filter=filter, + skip_token=skip_token, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AzureBackupRecoveryPointResourceList', pipeline_response) + deserialized = self._deserialize("AzureBackupRecoveryPointResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -120,7 +211,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -129,26 +224,27 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/recoveryPoints'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/recoveryPoints"} # type: ignore + @distributed_trace def get( self, - vault_name, # type: str - resource_group_name, # type: str - backup_instance_name, # type: str - recovery_point_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.AzureBackupRecoveryPointResource" + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + recovery_point_id: str, + **kwargs: Any + ) -> "_models.AzureBackupRecoveryPointResource": """Gets a Recovery Point using recoveryPointId for a Datasource. - :param vault_name: The name of the backup vault. - :type vault_name: str :param resource_group_name: The name of the resource group where the backup vault is present. :type resource_group_name: str + :param vault_name: The name of the backup vault. + :type vault_name: str :param backup_instance_name: The name of the backup instance. :type backup_instance_name: str :param recovery_point_id: @@ -163,30 +259,27 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'backupInstanceName': self._serialize.url("backup_instance_name", backup_instance_name, 'str'), - 'recoveryPointId': self._serialize.url("recovery_point_id", recovery_point_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-04-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + recovery_point_id=recovery_point_id, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -199,4 +292,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/recoveryPoints/{recoveryPointId}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/recoveryPoints/{recoveryPointId}"} # type: ignore + diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_resource_guards_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_resource_guards_operations.py index a6502b9277ab..20b3dc18a0ec 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_resource_guards_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_resource_guards_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,695 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_resources_in_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/resourceGuards") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_resources_in_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards") # 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'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_put_request( + resource_group_name: str, + subscription_id: str, + resource_guards_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + subscription_id: str, + resource_guards_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + subscription_id: str, + resource_guards_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_patch_request( + resource_group_name: str, + subscription_id: str, + resource_guards_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_disable_soft_delete_requests_objects_request( + resource_group_name: str, + subscription_id: str, + resource_guards_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/disableSoftDeleteRequests") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_delete_resource_guard_proxy_requests_objects_request( + resource_group_name: str, + subscription_id: str, + resource_guards_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/deleteResourceGuardProxyRequests") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_backup_security_pin_requests_objects_request( + resource_group_name: str, + subscription_id: str, + resource_guards_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/getBackupSecurityPINRequests") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_delete_protected_item_requests_objects_request( + resource_group_name: str, + subscription_id: str, + resource_guards_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/deleteProtectedItemRequests") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_update_protection_policy_requests_objects_request( + resource_group_name: str, + subscription_id: str, + resource_guards_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/updateProtectionPolicyRequests") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_update_protected_item_requests_objects_request( + resource_group_name: str, + subscription_id: str, + resource_guards_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/updateProtectedItemRequests") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_default_disable_soft_delete_requests_object_request( + resource_group_name: str, + subscription_id: str, + resource_guards_name: str, + request_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/disableSoftDeleteRequests/{requestName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, 'str'), + "requestName": _SERIALIZER.url("request_name", request_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_default_delete_resource_guard_proxy_requests_object_request( + resource_group_name: str, + subscription_id: str, + resource_guards_name: str, + request_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/deleteResourceGuardProxyRequests/{requestName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, 'str'), + "requestName": _SERIALIZER.url("request_name", request_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_default_backup_security_pin_requests_object_request( + resource_group_name: str, + subscription_id: str, + resource_guards_name: str, + request_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/getBackupSecurityPINRequests/{requestName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, 'str'), + "requestName": _SERIALIZER.url("request_name", request_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_default_delete_protected_item_requests_object_request( + resource_group_name: str, + subscription_id: str, + resource_guards_name: str, + request_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/deleteProtectedItemRequests/{requestName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, 'str'), + "requestName": _SERIALIZER.url("request_name", request_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_default_update_protection_policy_requests_object_request( + resource_group_name: str, + subscription_id: str, + resource_guards_name: str, + request_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/updateProtectionPolicyRequests/{requestName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, 'str'), + "requestName": _SERIALIZER.url("request_name", request_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_default_update_protected_item_requests_object_request( + resource_group_name: str, + subscription_id: str, + resource_guards_name: str, + request_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/updateProtectedItemRequests/{requestName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, 'str'), + "requestName": _SERIALIZER.url("request_name", request_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class ResourceGuardsOperations(object): """ResourceGuardsOperations operations. @@ -45,53 +718,54 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get_resources_in_subscription( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ResourceGuardResourceList"] + **kwargs: Any + ) -> Iterable["_models.ResourceGuardResourceList"]: """Returns ResourceGuards collection belonging to a subscription. Returns ResourceGuards collection belonging to a subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceGuardResourceList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.ResourceGuardResourceList] + :return: An iterator like instance of either ResourceGuardResourceList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.ResourceGuardResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGuardResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.get_resources_in_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_resources_in_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_resources_in_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_resources_in_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + 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('ResourceGuardResourceList', pipeline_response) + deserialized = self._deserialize("ResourceGuardResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -100,7 +774,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -109,17 +787,18 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - get_resources_in_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/resourceGuards'} # type: ignore + get_resources_in_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/resourceGuards"} # type: ignore + @distributed_trace def get_resources_in_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ResourceGuardResourceList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ResourceGuardResourceList"]: """Returns ResourceGuards collection belonging to a ResourceGroup. Returns ResourceGuards collection belonging to a ResourceGroup. @@ -127,44 +806,46 @@ def get_resources_in_resource_group( :param resource_group_name: The name of the resource group where the backup vault is present. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceGuardResourceList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.ResourceGuardResourceList] + :return: An iterator like instance of either ResourceGuardResourceList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.ResourceGuardResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGuardResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.get_resources_in_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_resources_in_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=self.get_resources_in_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_resources_in_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=next_link, + ) + 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('ResourceGuardResourceList', pipeline_response) + deserialized = self._deserialize("ResourceGuardResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -173,7 +854,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -182,19 +867,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - get_resources_in_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards'} # type: ignore + get_resources_in_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards"} # type: ignore + @distributed_trace def put( self, - resource_group_name, # type: str - resource_guards_name, # type: str - parameters, # type: "_models.ResourceGuardResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.ResourceGuardResource" + resource_group_name: str, + resource_guards_name: str, + parameters: "_models.ResourceGuardResource", + **kwargs: Any + ) -> "_models.ResourceGuardResource": """Creates or updates a ResourceGuard resource belonging to a resource group. Creates or updates a ResourceGuard resource belonging to a resource group. @@ -215,33 +901,29 @@ def put( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.put.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGuardsName': self._serialize.url("resource_guards_name", resource_guards_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ResourceGuardResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ResourceGuardResource') + + request = build_put_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + resource_guards_name=resource_guards_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.put.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -254,15 +936,17 @@ def put( return cls(pipeline_response, deserialized, {}) return deserialized - put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}'} # type: ignore + put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}"} # type: ignore + + + @distributed_trace def get( self, - resource_group_name, # type: str - resource_guards_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ResourceGuardResource" + resource_group_name: str, + resource_guards_name: str, + **kwargs: Any + ) -> "_models.ResourceGuardResource": """Returns a ResourceGuard belonging to a resource group. Returns a ResourceGuard belonging to a resource group. @@ -281,28 +965,25 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGuardsName': self._serialize.url("resource_guards_name", resource_guards_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-04-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + resource_guards_name=resource_guards_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -315,15 +996,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}'} # type: ignore - def delete( + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}"} # type: ignore + + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - resource_guards_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + resource_guards_name: str, + **kwargs: Any + ) -> None: """Deletes a ResourceGuard resource from the resource group. Deletes a ResourceGuard resource from the resource group. @@ -342,28 +1025,25 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGuardsName': self._serialize.url("resource_guards_name", resource_guards_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-04-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + resource_guards_name=resource_guards_name, + api_version=api_version, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -373,17 +1053,19 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}"} # type: ignore + + @distributed_trace def patch( self, - resource_group_name, # type: str - resource_guards_name, # type: str - parameters, # type: "_models.PatchResourceRequestInput" - **kwargs # type: Any - ): - # type: (...) -> "_models.ResourceGuardResource" - """Updates a ResourceGuard resource belonging to a resource group. For example, updating tags for a resource. + resource_group_name: str, + resource_guards_name: str, + parameters: "_models.PatchResourceRequestInput", + **kwargs: Any + ) -> "_models.ResourceGuardResource": + """Updates a ResourceGuard resource belonging to a resource group. For example, updating tags for + a resource. Updates a ResourceGuard resource belonging to a resource group. For example, updating tags for a resource. @@ -404,33 +1086,29 @@ def patch( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.patch.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGuardsName': self._serialize.url("resource_guards_name", resource_guards_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'PatchResourceRequestInput') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'PatchResourceRequestInput') + + request = build_patch_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + resource_guards_name=resource_guards_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.patch.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -443,16 +1121,19 @@ def patch( return cls(pipeline_response, deserialized, {}) return deserialized - patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}'} # type: ignore + patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}"} # type: ignore + + + @distributed_trace def get_disable_soft_delete_requests_objects( self, - resource_group_name, # type: str - resource_guards_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DppBaseResourceList"] - """Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + resource_group_name: str, + resource_guards_name: str, + **kwargs: Any + ) -> Iterable["_models.DppBaseResourceList"]: + """Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. @@ -466,41 +1147,42 @@ def get_disable_soft_delete_requests_objects( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.DppBaseResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DppBaseResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.get_disable_soft_delete_requests_objects.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGuardsName': self._serialize.url("resource_guards_name", resource_guards_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_disable_soft_delete_requests_objects_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + resource_guards_name=resource_guards_name, + api_version=api_version, + template_url=self.get_disable_soft_delete_requests_objects.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_disable_soft_delete_requests_objects_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + resource_guards_name=resource_guards_name, + api_version=api_version, + template_url=next_link, + ) + 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('DppBaseResourceList', pipeline_response) + deserialized = self._deserialize("DppBaseResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -509,7 +1191,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -518,19 +1204,21 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - get_disable_soft_delete_requests_objects.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/disableSoftDeleteRequests'} # type: ignore + get_disable_soft_delete_requests_objects.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/disableSoftDeleteRequests"} # type: ignore + @distributed_trace def get_delete_resource_guard_proxy_requests_objects( self, - resource_group_name, # type: str - resource_guards_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DppBaseResourceList"] - """Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + resource_group_name: str, + resource_guards_name: str, + **kwargs: Any + ) -> Iterable["_models.DppBaseResourceList"]: + """Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. @@ -544,41 +1232,42 @@ def get_delete_resource_guard_proxy_requests_objects( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.DppBaseResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DppBaseResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.get_delete_resource_guard_proxy_requests_objects.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGuardsName': self._serialize.url("resource_guards_name", resource_guards_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_delete_resource_guard_proxy_requests_objects_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + resource_guards_name=resource_guards_name, + api_version=api_version, + template_url=self.get_delete_resource_guard_proxy_requests_objects.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_delete_resource_guard_proxy_requests_objects_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + resource_guards_name=resource_guards_name, + api_version=api_version, + template_url=next_link, + ) + 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('DppBaseResourceList', pipeline_response) + deserialized = self._deserialize("DppBaseResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -587,7 +1276,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -596,19 +1289,21 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - get_delete_resource_guard_proxy_requests_objects.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/deleteResourceGuardProxyRequests'} # type: ignore + get_delete_resource_guard_proxy_requests_objects.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/deleteResourceGuardProxyRequests"} # type: ignore + @distributed_trace def get_backup_security_pin_requests_objects( self, - resource_group_name, # type: str - resource_guards_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DppBaseResourceList"] - """Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + resource_group_name: str, + resource_guards_name: str, + **kwargs: Any + ) -> Iterable["_models.DppBaseResourceList"]: + """Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. @@ -622,41 +1317,42 @@ def get_backup_security_pin_requests_objects( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.DppBaseResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DppBaseResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.get_backup_security_pin_requests_objects.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGuardsName': self._serialize.url("resource_guards_name", resource_guards_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_backup_security_pin_requests_objects_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + resource_guards_name=resource_guards_name, + api_version=api_version, + template_url=self.get_backup_security_pin_requests_objects.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_backup_security_pin_requests_objects_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + resource_guards_name=resource_guards_name, + api_version=api_version, + template_url=next_link, + ) + 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('DppBaseResourceList', pipeline_response) + deserialized = self._deserialize("DppBaseResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -665,7 +1361,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -674,19 +1374,21 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - get_backup_security_pin_requests_objects.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/getBackupSecurityPINRequests'} # type: ignore + get_backup_security_pin_requests_objects.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/getBackupSecurityPINRequests"} # type: ignore + @distributed_trace def get_delete_protected_item_requests_objects( self, - resource_group_name, # type: str - resource_guards_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DppBaseResourceList"] - """Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + resource_group_name: str, + resource_guards_name: str, + **kwargs: Any + ) -> Iterable["_models.DppBaseResourceList"]: + """Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. @@ -700,41 +1402,42 @@ def get_delete_protected_item_requests_objects( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.DppBaseResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DppBaseResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.get_delete_protected_item_requests_objects.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGuardsName': self._serialize.url("resource_guards_name", resource_guards_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_delete_protected_item_requests_objects_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + resource_guards_name=resource_guards_name, + api_version=api_version, + template_url=self.get_delete_protected_item_requests_objects.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_delete_protected_item_requests_objects_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + resource_guards_name=resource_guards_name, + api_version=api_version, + template_url=next_link, + ) + 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('DppBaseResourceList', pipeline_response) + deserialized = self._deserialize("DppBaseResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -743,7 +1446,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -752,19 +1459,21 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - get_delete_protected_item_requests_objects.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/deleteProtectedItemRequests'} # type: ignore + get_delete_protected_item_requests_objects.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/deleteProtectedItemRequests"} # type: ignore + @distributed_trace def get_update_protection_policy_requests_objects( self, - resource_group_name, # type: str - resource_guards_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DppBaseResourceList"] - """Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + resource_group_name: str, + resource_guards_name: str, + **kwargs: Any + ) -> Iterable["_models.DppBaseResourceList"]: + """Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. @@ -778,41 +1487,42 @@ def get_update_protection_policy_requests_objects( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.DppBaseResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DppBaseResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.get_update_protection_policy_requests_objects.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGuardsName': self._serialize.url("resource_guards_name", resource_guards_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_update_protection_policy_requests_objects_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + resource_guards_name=resource_guards_name, + api_version=api_version, + template_url=self.get_update_protection_policy_requests_objects.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_update_protection_policy_requests_objects_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + resource_guards_name=resource_guards_name, + api_version=api_version, + template_url=next_link, + ) + 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('DppBaseResourceList', pipeline_response) + deserialized = self._deserialize("DppBaseResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -821,7 +1531,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -830,19 +1544,21 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - get_update_protection_policy_requests_objects.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/updateProtectionPolicyRequests'} # type: ignore + get_update_protection_policy_requests_objects.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/updateProtectionPolicyRequests"} # type: ignore + @distributed_trace def get_update_protected_item_requests_objects( self, - resource_group_name, # type: str - resource_guards_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DppBaseResourceList"] - """Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + resource_group_name: str, + resource_guards_name: str, + **kwargs: Any + ) -> Iterable["_models.DppBaseResourceList"]: + """Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. @@ -856,41 +1572,42 @@ def get_update_protected_item_requests_objects( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.DppBaseResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DppBaseResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.get_update_protected_item_requests_objects.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGuardsName': self._serialize.url("resource_guards_name", resource_guards_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_update_protected_item_requests_objects_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + resource_guards_name=resource_guards_name, + api_version=api_version, + template_url=self.get_update_protected_item_requests_objects.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_update_protected_item_requests_objects_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + resource_guards_name=resource_guards_name, + api_version=api_version, + template_url=next_link, + ) + 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('DppBaseResourceList', pipeline_response) + deserialized = self._deserialize("DppBaseResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -899,7 +1616,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -908,20 +1629,22 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - get_update_protected_item_requests_objects.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/updateProtectedItemRequests'} # type: ignore + get_update_protected_item_requests_objects.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/updateProtectedItemRequests"} # type: ignore + @distributed_trace def get_default_disable_soft_delete_requests_object( self, - resource_group_name, # type: str - resource_guards_name, # type: str - request_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DppBaseResource" - """Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + 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 + ResourceGuard resource. Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. @@ -942,29 +1665,26 @@ def get_default_disable_soft_delete_requests_object( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get_default_disable_soft_delete_requests_object.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGuardsName': self._serialize.url("resource_guards_name", resource_guards_name, 'str'), - 'requestName': self._serialize.url("request_name", request_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-04-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_default_disable_soft_delete_requests_object_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + resource_guards_name=resource_guards_name, + request_name=request_name, + api_version=api_version, + template_url=self.get_default_disable_soft_delete_requests_object.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -977,17 +1697,20 @@ def get_default_disable_soft_delete_requests_object( return cls(pipeline_response, deserialized, {}) return deserialized - get_default_disable_soft_delete_requests_object.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/disableSoftDeleteRequests/{requestName}'} # type: ignore + get_default_disable_soft_delete_requests_object.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/disableSoftDeleteRequests/{requestName}"} # type: ignore + + + @distributed_trace def get_default_delete_resource_guard_proxy_requests_object( self, - resource_group_name, # type: str - resource_guards_name, # type: str - request_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DppBaseResource" - """Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + 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 + ResourceGuard resource. Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. @@ -1008,29 +1731,26 @@ def get_default_delete_resource_guard_proxy_requests_object( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get_default_delete_resource_guard_proxy_requests_object.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGuardsName': self._serialize.url("resource_guards_name", resource_guards_name, 'str'), - 'requestName': self._serialize.url("request_name", request_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-04-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_default_delete_resource_guard_proxy_requests_object_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + resource_guards_name=resource_guards_name, + request_name=request_name, + api_version=api_version, + template_url=self.get_default_delete_resource_guard_proxy_requests_object.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1043,17 +1763,20 @@ def get_default_delete_resource_guard_proxy_requests_object( return cls(pipeline_response, deserialized, {}) return deserialized - get_default_delete_resource_guard_proxy_requests_object.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/deleteResourceGuardProxyRequests/{requestName}'} # type: ignore + get_default_delete_resource_guard_proxy_requests_object.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/deleteResourceGuardProxyRequests/{requestName}"} # type: ignore + + + @distributed_trace def get_default_backup_security_pin_requests_object( self, - resource_group_name, # type: str - resource_guards_name, # type: str - request_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DppBaseResource" - """Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + 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 + ResourceGuard resource. Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. @@ -1074,29 +1797,26 @@ def get_default_backup_security_pin_requests_object( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get_default_backup_security_pin_requests_object.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGuardsName': self._serialize.url("resource_guards_name", resource_guards_name, 'str'), - 'requestName': self._serialize.url("request_name", request_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-04-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_default_backup_security_pin_requests_object_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + resource_guards_name=resource_guards_name, + request_name=request_name, + api_version=api_version, + template_url=self.get_default_backup_security_pin_requests_object.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1109,17 +1829,20 @@ def get_default_backup_security_pin_requests_object( return cls(pipeline_response, deserialized, {}) return deserialized - get_default_backup_security_pin_requests_object.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/getBackupSecurityPINRequests/{requestName}'} # type: ignore + get_default_backup_security_pin_requests_object.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/getBackupSecurityPINRequests/{requestName}"} # type: ignore + + + @distributed_trace def get_default_delete_protected_item_requests_object( self, - resource_group_name, # type: str - resource_guards_name, # type: str - request_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DppBaseResource" - """Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + 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 + ResourceGuard resource. Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. @@ -1140,29 +1863,26 @@ def get_default_delete_protected_item_requests_object( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get_default_delete_protected_item_requests_object.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGuardsName': self._serialize.url("resource_guards_name", resource_guards_name, 'str'), - 'requestName': self._serialize.url("request_name", request_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-04-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_default_delete_protected_item_requests_object_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + resource_guards_name=resource_guards_name, + request_name=request_name, + api_version=api_version, + template_url=self.get_default_delete_protected_item_requests_object.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1175,17 +1895,20 @@ def get_default_delete_protected_item_requests_object( return cls(pipeline_response, deserialized, {}) return deserialized - get_default_delete_protected_item_requests_object.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/deleteProtectedItemRequests/{requestName}'} # type: ignore + get_default_delete_protected_item_requests_object.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/deleteProtectedItemRequests/{requestName}"} # type: ignore + + + @distributed_trace def get_default_update_protection_policy_requests_object( self, - resource_group_name, # type: str - resource_guards_name, # type: str - request_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DppBaseResource" - """Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + 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 + ResourceGuard resource. Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. @@ -1206,29 +1929,26 @@ def get_default_update_protection_policy_requests_object( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get_default_update_protection_policy_requests_object.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGuardsName': self._serialize.url("resource_guards_name", resource_guards_name, 'str'), - 'requestName': self._serialize.url("request_name", request_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-04-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_default_update_protection_policy_requests_object_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + resource_guards_name=resource_guards_name, + request_name=request_name, + api_version=api_version, + template_url=self.get_default_update_protection_policy_requests_object.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1241,17 +1961,20 @@ def get_default_update_protection_policy_requests_object( return cls(pipeline_response, deserialized, {}) return deserialized - get_default_update_protection_policy_requests_object.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/updateProtectionPolicyRequests/{requestName}'} # type: ignore + get_default_update_protection_policy_requests_object.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/updateProtectionPolicyRequests/{requestName}"} # type: ignore + + + @distributed_trace def get_default_update_protected_item_requests_object( self, - resource_group_name, # type: str - resource_guards_name, # type: str - request_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DppBaseResource" - """Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + 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 + ResourceGuard resource. Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. @@ -1272,29 +1995,26 @@ def get_default_update_protected_item_requests_object( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get_default_update_protected_item_requests_object.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGuardsName': self._serialize.url("resource_guards_name", resource_guards_name, 'str'), - 'requestName': self._serialize.url("request_name", request_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-04-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_default_update_protected_item_requests_object_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + resource_guards_name=resource_guards_name, + request_name=request_name, + api_version=api_version, + template_url=self.get_default_update_protected_item_requests_object.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1307,4 +2027,6 @@ def get_default_update_protected_item_requests_object( return cls(pipeline_response, deserialized, {}) return deserialized - get_default_update_protected_item_requests_object.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/updateProtectedItemRequests/{requestName}'} # type: ignore + + get_default_update_protected_item_requests_object.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/updateProtectedItemRequests/{requestName}"} # type: ignore + diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_restorable_time_ranges_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_restorable_time_ranges_operations.py index c35009b32d98..48eb00fa75dc 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_restorable_time_ranges_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_restorable_time_ranges_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,22 +6,70 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_find_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/findRestorableTimeRanges") # 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'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) class RestorableTimeRangesOperations(object): """RestorableTimeRangesOperations operations. @@ -44,21 +93,21 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def find( self, - vault_name, # type: str - resource_group_name, # type: str - backup_instance_name, # type: str - parameters, # type: "_models.AzureBackupFindRestorableTimeRangesRequest" - **kwargs # type: Any - ): - # type: (...) -> "_models.AzureBackupFindRestorableTimeRangesResponseResource" + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: "_models.AzureBackupFindRestorableTimeRangesRequest", + **kwargs: Any + ) -> "_models.AzureBackupFindRestorableTimeRangesResponseResource": """find. - :param vault_name: The name of the backup vault. - :type vault_name: str :param resource_group_name: The name of the resource group where the backup vault is present. :type resource_group_name: str + :param vault_name: The name of the backup vault. + :type vault_name: str :param backup_instance_name: The name of the backup instance. :type backup_instance_name: str :param parameters: Request body for operation. @@ -73,34 +122,30 @@ def find( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.find.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'backupInstanceName': self._serialize.url("backup_instance_name", backup_instance_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'AzureBackupFindRestorableTimeRangesRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'AzureBackupFindRestorableTimeRangesRequest') + + request = build_find_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.find.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -113,4 +158,6 @@ def find( return cls(pipeline_response, deserialized, {}) return deserialized - find.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/findRestorableTimeRanges'} # type: ignore + + find.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/findRestorableTimeRanges"} # type: ignore +