diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/CHANGELOG.md b/sdk/dataprotection/azure-mgmt-dataprotection/CHANGELOG.md new file mode 100644 index 000000000000..578ed6acf479 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 0.1.0 (1970-01-01) + +* Initial Release diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/LICENSE.txt b/sdk/dataprotection/azure-mgmt-dataprotection/LICENSE.txt new file mode 100644 index 000000000000..2d3163745319 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2021 Microsoft + +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. diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/MANIFEST.in b/sdk/dataprotection/azure-mgmt-dataprotection/MANIFEST.in new file mode 100644 index 000000000000..ef61eb0e3527 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/MANIFEST.in @@ -0,0 +1,6 @@ +include _meta.json +recursive-include tests *.py *.yaml +include *.md +include azure/__init__.py +include azure/mgmt/__init__.py +include LICENSE.txt diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/README.md b/sdk/dataprotection/azure-mgmt-dataprotection/README.md new file mode 100644 index 000000000000..d65e405b686c --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/README.md @@ -0,0 +1,27 @@ +# Microsoft Azure SDK for Python + +This is the Microsoft Azure MyService Management Client Library. +This package has been tested with Python 2.7, 3.6+. +For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). + + +# Usage + + +To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) + + + +For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/) +Code samples for this package can be found at [MyService Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. +Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +# Provide Feedback + +If you encounter any bugs or have suggestions, please file an issue in the +[Issues](https://github.com/Azure/azure-sdk-for-python/issues) +section of the project. + + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-dataprotection%2FREADME.png) diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/_meta.json b/sdk/dataprotection/azure-mgmt-dataprotection/_meta.json new file mode 100644 index 000000000000..ec7cc250ecc3 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/_meta.json @@ -0,0 +1,11 @@ +{ + "autorest": "3.4.5", + "use": [ + "@autorest/python@5.8.4", + "@autorest/modelerfour@4.19.2" + ], + "commit": "8d0a1bce1741e7b181746bcce6ad25dad31a3b11", + "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", + "readme": "specification/dataprotection/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/__init__.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/__init__.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/__init__.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/__init__.py new file mode 100644 index 000000000000..9dfda54e0346 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/__init__.py @@ -0,0 +1,19 @@ +# 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 ._data_protection_client import DataProtectionClient +from ._version import VERSION + +__version__ = VERSION +__all__ = ['DataProtectionClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_configuration.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_configuration.py new file mode 100644 index 000000000000..d38b045a587e --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_configuration.py @@ -0,0 +1,71 @@ +# 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 TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import 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): + """Configuration for DataProtectionClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :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 + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + 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.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-dataprotection/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + 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) 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 new file mode 100644 index 000000000000..85019b92c77f --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_data_protection_client.py @@ -0,0 +1,154 @@ +# 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 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 ._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 + + +class DataProtectionClient(object): + """Open API 2.0 Specs for Azure Data Protection service. + + :ivar backup_vaults: BackupVaultsOperations operations + :vartype backup_vaults: azure.mgmt.dataprotection.operations.BackupVaultsOperations + :ivar operation_result: OperationResultOperations operations + :vartype operation_result: azure.mgmt.dataprotection.operations.OperationResultOperations + :ivar operation_status: OperationStatusOperations operations + :vartype operation_status: azure.mgmt.dataprotection.operations.OperationStatusOperations + :ivar backup_vault_operation_results: BackupVaultOperationResultsOperations operations + :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 + :ivar backup_policies: BackupPoliciesOperations operations + :vartype backup_policies: azure.mgmt.dataprotection.operations.BackupPoliciesOperations + :ivar backup_instances: BackupInstancesOperations operations + :vartype backup_instances: azure.mgmt.dataprotection.operations.BackupInstancesOperations + :ivar recovery_points: RecoveryPointsOperations operations + :vartype recovery_points: azure.mgmt.dataprotection.operations.RecoveryPointsOperations + :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 + :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 + :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. + """ + + 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) + 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 + """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. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.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 + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> DataProtectionClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_metadata.json b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_metadata.json new file mode 100644 index 000000000000..8360a7bf7cd9 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_metadata.json @@ -0,0 +1,116 @@ +{ + "chosen_version": "2021-07-01", + "total_api_version_list": ["2021-07-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, + "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\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "The subscription Id.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "The subscription Id.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "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\"]}}}" + }, + "operation_groups": { + "backup_vaults": "BackupVaultsOperations", + "operation_result": "OperationResultOperations", + "operation_status": "OperationStatusOperations", + "backup_vault_operation_results": "BackupVaultOperationResultsOperations", + "data_protection": "DataProtectionOperations", + "data_protection_operations": "DataProtectionOperationsOperations", + "backup_policies": "BackupPoliciesOperations", + "backup_instances": "BackupInstancesOperations", + "recovery_points": "RecoveryPointsOperations", + "jobs": "JobsOperations", + "restorable_time_ranges": "RestorableTimeRangesOperations", + "export_jobs": "ExportJobsOperations", + "export_jobs_operation_result": "ExportJobsOperationResultOperations", + "resource_guards": "ResourceGuardsOperations" + } +} \ No newline at end of file diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_version.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_version.py @@ -0,0 +1,9 @@ +# 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. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" 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 new file mode 100644 index 000000000000..d1235b93a84d --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/__init__.py @@ -0,0 +1,10 @@ +# 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 ._data_protection_client import DataProtectionClient +__all__ = ['DataProtectionClient'] 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 new file mode 100644 index 000000000000..9fcfed8d9fab --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/_configuration.py @@ -0,0 +1,67 @@ +# 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, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class DataProtectionClientConfiguration(Configuration): + """Configuration for DataProtectionClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :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 + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + 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.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-dataprotection/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + 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) 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 new file mode 100644 index 000000000000..f4ae7f1b520c --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/_data_protection_client.py @@ -0,0 +1,147 @@ +# 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, Optional, 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 ._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 + + +class DataProtectionClient(object): + """Open API 2.0 Specs for Azure Data Protection service. + + :ivar backup_vaults: BackupVaultsOperations operations + :vartype backup_vaults: azure.mgmt.dataprotection.aio.operations.BackupVaultsOperations + :ivar operation_result: OperationResultOperations operations + :vartype operation_result: azure.mgmt.dataprotection.aio.operations.OperationResultOperations + :ivar operation_status: OperationStatusOperations operations + :vartype operation_status: azure.mgmt.dataprotection.aio.operations.OperationStatusOperations + :ivar backup_vault_operation_results: BackupVaultOperationResultsOperations operations + :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 + :ivar backup_policies: BackupPoliciesOperations operations + :vartype backup_policies: azure.mgmt.dataprotection.aio.operations.BackupPoliciesOperations + :ivar backup_instances: BackupInstancesOperations operations + :vartype backup_instances: azure.mgmt.dataprotection.aio.operations.BackupInstancesOperations + :ivar recovery_points: RecoveryPointsOperations operations + :vartype recovery_points: azure.mgmt.dataprotection.aio.operations.RecoveryPointsOperations + :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 + :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 + :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. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = DataProtectionClientConfiguration(credential, 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.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: + """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. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.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 + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "DataProtectionClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) 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 new file mode 100644 index 000000000000..f9c765bb82a0 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/__init__.py @@ -0,0 +1,39 @@ +# 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 ._backup_vaults_operations import BackupVaultsOperations +from ._operation_result_operations import OperationResultOperations +from ._operation_status_operations import OperationStatusOperations +from ._backup_vault_operation_results_operations import BackupVaultOperationResultsOperations +from ._data_protection_operations import DataProtectionOperations +from ._data_protection_operations_operations import DataProtectionOperationsOperations +from ._backup_policies_operations import BackupPoliciesOperations +from ._backup_instances_operations import BackupInstancesOperations +from ._recovery_points_operations import RecoveryPointsOperations +from ._jobs_operations import JobsOperations +from ._restorable_time_ranges_operations import RestorableTimeRangesOperations +from ._export_jobs_operations import ExportJobsOperations +from ._export_jobs_operation_result_operations import ExportJobsOperationResultOperations +from ._resource_guards_operations import ResourceGuardsOperations + +__all__ = [ + 'BackupVaultsOperations', + 'OperationResultOperations', + 'OperationStatusOperations', + 'BackupVaultOperationResultsOperations', + 'DataProtectionOperations', + 'DataProtectionOperationsOperations', + 'BackupPoliciesOperations', + 'BackupInstancesOperations', + 'RecoveryPointsOperations', + 'JobsOperations', + 'RestorableTimeRangesOperations', + 'ExportJobsOperations', + 'ExportJobsOperationResultOperations', + 'ResourceGuardsOperations', +] 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 new file mode 100644 index 000000000000..ff56d2bc2e8d --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_instances_operations.py @@ -0,0 +1,1116 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +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.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class BackupInstancesOperations: + """BackupInstancesOperations 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 + + def list( + self, + vault_name: str, + resource_group_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 + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('BackupInstanceResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(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) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances'} # type: ignore + + async def get( + self, + vault_name: str, + resource_group_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 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 + :return: BackupInstanceResource, or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.BackupInstanceResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupInstanceResource"] + 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.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') + + # 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) + 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('BackupInstanceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + 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, + backup_instance_name: str, + parameters: "_models.BackupInstanceResource", + **kwargs: Any + ) -> "_models.BackupInstanceResource": + cls = kwargs.pop('cls', None) # type: ClsType["_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) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('BackupInstanceResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('BackupInstanceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}'} # type: ignore + + async def begin_create_or_update( + self, + vault_name: str, + resource_group_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 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. + :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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupInstanceResource"] + 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._create_or_update_initial( + vault_name=vault_name, + resource_group_name=resource_group_name, + backup_instance_name=backup_instance_name, + parameters=parameters, + 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('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) + 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 + ) + 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 + + async def _delete_initial( + self, + vault_name: str, + resource_group_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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + 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) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}'} # type: ignore + + async def begin_delete( + self, + vault_name: str, + resource_group_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 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. + :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: + """ + 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._delete_initial( + vault_name=vault_name, + resource_group_name=resource_group_name, + backup_instance_name=backup_instance_name, + 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) + 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 + ) + 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 + + async def _adhoc_backup_initial( + self, + vault_name: str, + resource_group_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 = await self._client._pipeline.run(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 + 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 + _adhoc_backup_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/backup'} # type: ignore + + async def begin_adhoc_backup( + self, + vault_name: str, + resource_group_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 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. + :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: + """ + 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._adhoc_backup_initial( + vault_name=vault_name, + resource_group_name=resource_group_name, + backup_instance_name=backup_instance_name, + parameters=parameters, + 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 + + 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) + 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 + ) + 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 + + async def _validate_for_backup_initial( + self, + vault_name: str, + resource_group_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 = await self._client._pipeline.run(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 + 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_backup_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/validateForBackup'} # type: ignore + + async def begin_validate_for_backup( + self, + vault_name: str, + resource_group_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 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. + :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: + """ + 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_backup_initial( + vault_name=vault_name, + resource_group_name=resource_group_name, + parameters=parameters, + 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 + + 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) + 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 + ) + 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 + + async def _trigger_rehydrate_initial( + 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 + } + 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) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + 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) + + _trigger_rehydrate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/rehydrate'} # type: ignore + + async def begin_trigger_rehydrate( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: "_models.AzureBackupRehydrationRequest", + **kwargs: Any + ) -> AsyncLROPoller[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. + :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.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. + :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: + """ + 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._trigger_rehydrate_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + parameters=parameters, + 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) + 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 + ) + 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 + + async def _trigger_restore_initial( + self, + vault_name: str, + resource_group_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 = await self._client._pipeline.run(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 + if response.status_code == 200: + deserialized = self._deserialize('OperationJobExtendedInfo', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _trigger_restore_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/restore'} # type: ignore + + async def begin_trigger_restore( + self, + vault_name: str, + resource_group_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 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. + :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: + """ + 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._trigger_restore_initial( + vault_name=vault_name, + resource_group_name=resource_group_name, + backup_instance_name=backup_instance_name, + parameters=parameters, + 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 + + 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) + 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 + ) + 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 + + async def _validate_for_restore_initial( + self, + vault_name: str, + resource_group_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 = "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) + 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 + 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 + + async def begin_validate_for_restore( + self, + vault_name: str, + resource_group_name: str, + backup_instance_name: str, + parameters: "_models.ValidateRestoreRequestObject", + **kwargs: Any + ) -> AsyncLROPoller["_models.OperationJobExtendedInfo"]: + """Validates if Restore can be triggered 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 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: + """ + 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( + vault_name=vault_name, + resource_group_name=resource_group_name, + backup_instance_name=backup_instance_name, + parameters=parameters, + 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 + + 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) + 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 + ) + 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 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 new file mode 100644 index 000000000000..3b220c4d6253 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_policies_operations.py @@ -0,0 +1,313 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +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.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class BackupPoliciesOperations: + """BackupPoliciesOperations 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 + + def list( + self, + vault_name: str, + resource_group_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 + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('BaseBackupPolicyResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(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) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies'} # type: ignore + + async def get( + self, + vault_name: str, + resource_group_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 backup_policy_name: + :type backup_policy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BaseBackupPolicyResource, or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.BaseBackupPolicyResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BaseBackupPolicyResource"] + 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.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') + + # 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) + 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('BaseBackupPolicyResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}'} # type: ignore + + async def create_or_update( + self, + vault_name: str, + resource_group_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 backup_policy_name: Name of the policy. + :type backup_policy_name: str + :param parameters: Request body for operation. + :type parameters: ~azure.mgmt.dataprotection.models.BaseBackupPolicyResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BaseBackupPolicyResource, or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.BaseBackupPolicyResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BaseBackupPolicyResource"] + 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.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) + 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('BaseBackupPolicyResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}'} # type: ignore + + async def delete( + self, + vault_name: str, + resource_group_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 backup_policy_name: + :type backup_policy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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.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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/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 new file mode 100644 index 000000000000..22c61b0cc12b --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_vault_operation_results_operations.py @@ -0,0 +1,111 @@ +# 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, Generic, Optional, TypeVar +import warnings + +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.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class BackupVaultOperationResultsOperations: + """BackupVaultOperationResultsOperations 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 + + async def get( + self, + vault_name: str, + resource_group_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 operation_id: + :type operation_id: 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 or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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" + 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) + 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 + if response.status_code == 200: + deserialized = self._deserialize('BackupVaultResource', 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 + 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 new file mode 100644 index 000000000000..d0bc61275c7b --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_vaults_operations.py @@ -0,0 +1,616 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +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.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class BackupVaultsOperations: + """BackupVaultsOperations 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 + + def get_in_subscription( + self, + **kwargs: Any + ) -> AsyncIterable["_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) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.BackupVaultResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('BackupVaultResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(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) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + get_in_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/backupVaults'} # type: ignore + + def get_in_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_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) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.BackupVaultResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('BackupVaultResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(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) + + 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 + + async def get( + self, + vault_name: str, + resource_group_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 + :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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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" + 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') + + # 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) + 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('BackupVaultResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + 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, + 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 = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('BackupVaultResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('BackupVaultResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}'} # type: ignore + + async def begin_create_or_update( + self, + vault_name: str, + resource_group_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 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. + :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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupVaultResource"] + 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._create_or_update_initial( + vault_name=vault_name, + resource_group_name=resource_group_name, + parameters=parameters, + 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('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) + 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 + ) + 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 + + async def delete( + self, + vault_name: str, + resource_group_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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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.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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}'} # type: ignore + + async def _update_initial( + self, + vault_name: str, + resource_group_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 = await self._client._pipeline.run(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('BackupVaultResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}'} # type: ignore + + async def begin_update( + self, + vault_name: str, + resource_group_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 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. + :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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupVaultResource"] + 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._update_initial( + vault_name=vault_name, + resource_group_name=resource_group_name, + parameters=parameters, + 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('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) + 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 + ) + 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 + + async def check_name_availability( + self, + 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. + + :param resource_group_name: The name of the resource group where the backup vault is present. + :type resource_group_name: str + :param location: The location in which uniqueness will be verified. + :type location: str + :param parameters: Check name availability request. + :type parameters: ~azure.mgmt.dataprotection.models.CheckNameAvailabilityRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult, or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.CheckNameAvailabilityResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] + 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.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) + 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('CheckNameAvailabilityResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + 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 new file mode 100644 index 000000000000..4f4c02a41fbf --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_data_protection_operations.py @@ -0,0 +1,105 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +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.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DataProtectionOperations: + """DataProtectionOperations 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 + + async def check_feature_support( + self, + location: str, + parameters: "_models.FeatureValidationRequestBase", + **kwargs: Any + ) -> "_models.FeatureValidationResponseBase": + """Validates if a feature is supported. + + Validates if a feature is supported. + + :param location: + :type location: str + :param parameters: Feature support request object. + :type parameters: ~azure.mgmt.dataprotection.models.FeatureValidationRequestBase + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FeatureValidationResponseBase, or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.FeatureValidationResponseBase + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.FeatureValidationResponseBase"] + 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.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) + 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('FeatureValidationResponseBase', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + 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 new file mode 100644 index 000000000000..c214a878307e --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_data_protection_operations_operations.py @@ -0,0 +1,104 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +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.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DataProtectionOperationsOperations: + """DataProtectionOperationsOperations 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 + + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_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) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.ClientDiscoveryResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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 = 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ClientDiscoveryResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(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) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + 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 new file mode 100644 index 000000000000..5229fa069641 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_export_jobs_operation_result_operations.py @@ -0,0 +1,107 @@ +# 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, Generic, Optional, TypeVar +import warnings + +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.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ExportJobsOperationResultOperations: + """ExportJobsOperationResultOperations 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 + + async def get( + self, + 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. + + :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: OperationID which represents the export job. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExportJobsResult, or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.ExportJobsResult or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ExportJobsResult"]] + 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.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) + 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('ExportJobsResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + 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 new file mode 100644 index 000000000000..9e54054ad0ea --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_export_jobs_operations.py @@ -0,0 +1,156 @@ +# 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, Generic, Optional, TypeVar, Union +import warnings + +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.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ExportJobsOperations: + """ExportJobsOperations 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 + + async def _trigger_initial( + self, + 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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + 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['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 + + async def begin_trigger( + self, + resource_group_name: str, + vault_name: str, + **kwargs: Any + ) -> AsyncLROPoller[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. + :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 + :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: + """ + 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._trigger_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + 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) + 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 + ) + 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 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 new file mode 100644 index 000000000000..8cce9e55bcfc --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_jobs_operations.py @@ -0,0 +1,179 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +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.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class JobsOperations: + """JobsOperations 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 + + def list( + self, + resource_group_name: str, + vault_name: str, + **kwargs: Any + ) -> AsyncIterable["_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. + :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 AzureBackupJobResourceList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.AzureBackupJobResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('AzureBackupJobResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(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) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs'} # type: ignore + + async def get( + self, + 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. + :type resource_group_name: str + :param vault_name: The name of the backup vault. + :type vault_name: str + :param job_id: The Job ID. This is a GUID-formatted string (e.g. + 00000000-0000-0000-0000-000000000000). + :type job_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AzureBackupJobResource, or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.AzureBackupJobResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AzureBackupJobResource"] + 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.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') + + # 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) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AzureBackupJobResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/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 new file mode 100644 index 000000000000..4793f47b4c57 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_result_operations.py @@ -0,0 +1,109 @@ +# 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, Generic, Optional, TypeVar +import warnings + +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.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class OperationResultOperations: + """OperationResultOperations 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 + + async def get( + self, + operation_id: str, + location: str, + **kwargs: Any + ) -> Optional["_models.OperationJobExtendedInfo"]: + """Gets the operation status for a resource. + + Gets the operation result for a resource. + + :param operation_id: + :type operation_id: str + :param location: + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OperationJobExtendedInfo, or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.OperationJobExtendedInfo or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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" + 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) + 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 + 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 + 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_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_status_operations.py new file mode 100644 index 000000000000..cd20c682149d --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_status_operations.py @@ -0,0 +1,101 @@ +# 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, Generic, Optional, TypeVar +import warnings + +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.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class OperationStatusOperations: + """OperationStatusOperations 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 + + async def get( + self, + location: str, + operation_id: str, + **kwargs: Any + ) -> "_models.OperationResource": + """Gets the operation status for a resource. + + Gets the operation status for a resource. + + :param location: + :type location: 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 = "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) + 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}/providers/Microsoft.DataProtection/locations/{location}/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 new file mode 100644 index 000000000000..efb6fbeb9455 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_recovery_points_operations.py @@ -0,0 +1,196 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +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.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class RecoveryPointsOperations: + """RecoveryPointsOperations 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 + + def list( + self, + vault_name: str, + resource_group_name: str, + backup_instance_name: str, + filter: Optional[str] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> 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 backup_instance_name: The name of the backup instance. + :type backup_instance_name: str + :param filter: OData filter options. + :type filter: str + :param skip_token: skipToken Filter. + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('AzureBackupRecoveryPointResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(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) + + 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 + + async def get( + self, + vault_name: str, + resource_group_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 backup_instance_name: The name of the backup instance. + :type backup_instance_name: str + :param recovery_point_id: + :type recovery_point_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AzureBackupRecoveryPointResource, or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.AzureBackupRecoveryPointResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AzureBackupRecoveryPointResource"] + 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.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') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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('AzureBackupRecoveryPointResource', pipeline_response) + + if cls: + 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 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 new file mode 100644 index 000000000000..0f9b1f08b6b6 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_resource_guards_operations.py @@ -0,0 +1,1288 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +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.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ResourceGuardsOperations: + """ResourceGuardsOperations 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 + + def get_resources_in_subscription( + self, + **kwargs: Any + ) -> AsyncIterable["_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.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.ResourceGuardResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceGuardResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(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) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + get_resources_in_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/resourceGuards'} # type: ignore + + def get_resources_in_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ResourceGuardResourceList"]: + """Returns ResourceGuards collection belonging to a ResourceGroup. + + Returns ResourceGuards collection belonging to a ResourceGroup. + + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceGuardResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(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) + + 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 + + async def put( + self, + 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. + + :param resource_group_name: The name of the resource group where the backup vault is present. + :type resource_group_name: str + :param resource_guards_name: The name of ResourceGuard. + :type resource_guards_name: str + :param parameters: Request body for operation. + :type parameters: ~azure.mgmt.dataprotection.models.ResourceGuardResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceGuardResource, or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGuardResource"] + 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.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) + 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('ResourceGuardResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}'} # type: ignore + + async def get( + self, + 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. + + :param resource_group_name: The name of the resource group where the backup vault is present. + :type resource_group_name: str + :param resource_guards_name: The name of ResourceGuard. + :type resource_guards_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceGuardResource, or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGuardResource"] + 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.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') + + # 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) + 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('ResourceGuardResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + resource_guards_name: str, + **kwargs: Any + ) -> None: + """Deletes a ResourceGuard resource from the resource group. + + Deletes a ResourceGuard resource from the resource group. + + :param resource_group_name: The name of the resource group where the backup vault is present. + :type resource_group_name: str + :param resource_guards_name: The name of ResourceGuard. + :type resource_guards_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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.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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}'} # type: ignore + + async def patch( + self, + 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. + + :param resource_group_name: The name of the resource group where the backup vault is present. + :type resource_group_name: str + :param resource_guards_name: The name of ResourceGuard. + :type resource_guards_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 + :return: ResourceGuardResource, or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGuardResource"] + 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.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) + 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('ResourceGuardResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}'} # type: ignore + + 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. + + :param resource_group_name: The name of the resource group where the backup vault is present. + :type resource_group_name: str + :param resource_guards_name: + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DppBaseResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(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) + + 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 + + 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. + + :param resource_group_name: The name of the resource group where the backup vault is present. + :type resource_group_name: str + :param resource_guards_name: + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DppBaseResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(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) + + 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 + + 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. + + :param resource_group_name: The name of the resource group where the backup vault is present. + :type resource_group_name: str + :param resource_guards_name: + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DppBaseResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(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) + + 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 + + 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. + + :param resource_group_name: The name of the resource group where the backup vault is present. + :type resource_group_name: str + :param resource_guards_name: + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DppBaseResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(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) + + 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 + + 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. + + :param resource_group_name: The name of the resource group where the backup vault is present. + :type resource_group_name: str + :param resource_guards_name: + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DppBaseResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(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) + + 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 + + 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. + + :param resource_group_name: The name of the resource group where the backup vault is present. + :type resource_group_name: str + :param resource_guards_name: + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DppBaseResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(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) + + 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 + + async def get_default_disable_soft_delete_requests_object( + self, + resource_group_name: str, + resource_guards_name: str, + request_name: str, + **kwargs: Any + ) -> "_models.DppBaseResource": + """Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + + Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. + + :param resource_group_name: The name of the resource group where the backup vault is present. + :type resource_group_name: str + :param resource_guards_name: + :type resource_guards_name: str + :param request_name: + :type request_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DppBaseResource, or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.DppBaseResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DppBaseResource"] + 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.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') + + # 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) + 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('DppBaseResource', pipeline_response) + + if cls: + 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 + + async def get_default_delete_resource_guard_proxy_requests_object( + self, + resource_group_name: str, + resource_guards_name: str, + request_name: str, + **kwargs: Any + ) -> "_models.DppBaseResource": + """Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + + Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. + + :param resource_group_name: The name of the resource group where the backup vault is present. + :type resource_group_name: str + :param resource_guards_name: + :type resource_guards_name: str + :param request_name: + :type request_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DppBaseResource, or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.DppBaseResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DppBaseResource"] + 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.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') + + # 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) + 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('DppBaseResource', pipeline_response) + + if cls: + 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 + + async def get_default_backup_security_pin_requests_object( + self, + resource_group_name: str, + resource_guards_name: str, + request_name: str, + **kwargs: Any + ) -> "_models.DppBaseResource": + """Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + + Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. + + :param resource_group_name: The name of the resource group where the backup vault is present. + :type resource_group_name: str + :param resource_guards_name: + :type resource_guards_name: str + :param request_name: + :type request_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DppBaseResource, or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.DppBaseResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DppBaseResource"] + 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.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') + + # 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) + 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('DppBaseResource', pipeline_response) + + if cls: + 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 + + async def get_default_delete_protected_item_requests_object( + self, + resource_group_name: str, + resource_guards_name: str, + request_name: str, + **kwargs: Any + ) -> "_models.DppBaseResource": + """Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + + Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. + + :param resource_group_name: The name of the resource group where the backup vault is present. + :type resource_group_name: str + :param resource_guards_name: + :type resource_guards_name: str + :param request_name: + :type request_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DppBaseResource, or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.DppBaseResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DppBaseResource"] + 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.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') + + # 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) + 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('DppBaseResource', pipeline_response) + + if cls: + 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 + + async def get_default_update_protection_policy_requests_object( + self, + resource_group_name: str, + resource_guards_name: str, + request_name: str, + **kwargs: Any + ) -> "_models.DppBaseResource": + """Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + + Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. + + :param resource_group_name: The name of the resource group where the backup vault is present. + :type resource_group_name: str + :param resource_guards_name: + :type resource_guards_name: str + :param request_name: + :type request_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DppBaseResource, or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.DppBaseResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DppBaseResource"] + 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.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') + + # 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) + 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('DppBaseResource', pipeline_response) + + if cls: + 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 + + async def get_default_update_protected_item_requests_object( + self, + resource_group_name: str, + resource_guards_name: str, + request_name: str, + **kwargs: Any + ) -> "_models.DppBaseResource": + """Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + + Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. + + :param resource_group_name: The name of the resource group where the backup vault is present. + :type resource_group_name: str + :param resource_guards_name: + :type resource_guards_name: str + :param request_name: + :type request_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DppBaseResource, or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.DppBaseResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DppBaseResource"] + 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.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') + + # 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) + 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('DppBaseResource', pipeline_response) + + if cls: + 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 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 new file mode 100644 index 000000000000..73ec6d0bed24 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_restorable_time_ranges_operations.py @@ -0,0 +1,111 @@ +# 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, Generic, Optional, TypeVar +import warnings + +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.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class RestorableTimeRangesOperations: + """RestorableTimeRangesOperations 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 + + async def find( + self, + vault_name: str, + resource_group_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 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.AzureBackupFindRestorableTimeRangesRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AzureBackupFindRestorableTimeRangesResponseResource, or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.AzureBackupFindRestorableTimeRangesResponseResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AzureBackupFindRestorableTimeRangesResponseResource"] + 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.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) + 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('AzureBackupFindRestorableTimeRangesResponseResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + 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 new file mode 100644 index 000000000000..1d823e9b0535 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/__init__.py @@ -0,0 +1,403 @@ +# 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. +# -------------------------------------------------------------------------- + +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 ._data_protection_client_enums import ( + AbsoluteMarker, + CreatedByType, + CurrentProtectionState, + DataStoreTypes, + DayOfWeek, + FeatureSupportStatus, + FeatureType, + Month, + ProvisioningState, + RecoveryOption, + RehydrationPriority, + RehydrationStatus, + ResourceMoveState, + RestoreSourceDataStoreType, + RestoreTargetLocationType, + SecretStoreType, + SourceDataStoreType, + Status, + StorageSettingStoreTypes, + StorageSettingTypes, + WeekNumber, +) + +__all__ = [ + 'AbsoluteDeleteOption', + 'AdHocBackupRuleOptions', + 'AdhocBackupTriggerOption', + 'AdhocBasedTaggingCriteria', + 'AdhocBasedTriggerContext', + 'AuthCredentials', + 'AzureBackupDiscreteRecoveryPoint', + 'AzureBackupFindRestorableTimeRangesRequest', + 'AzureBackupFindRestorableTimeRangesRequestResource', + 'AzureBackupFindRestorableTimeRangesResponse', + 'AzureBackupFindRestorableTimeRangesResponseResource', + 'AzureBackupJob', + 'AzureBackupJobResource', + 'AzureBackupJobResourceList', + 'AzureBackupParams', + 'AzureBackupRecoveryPoint', + 'AzureBackupRecoveryPointBasedRestoreRequest', + 'AzureBackupRecoveryPointResource', + 'AzureBackupRecoveryPointResourceList', + 'AzureBackupRecoveryTimeBasedRestoreRequest', + 'AzureBackupRehydrationRequest', + 'AzureBackupRestoreRequest', + 'AzureBackupRestoreWithRehydrationRequest', + 'AzureBackupRule', + 'AzureOperationalStoreParameters', + 'AzureRetentionRule', + 'BackupCriteria', + 'BackupInstance', + 'BackupInstanceResource', + 'BackupInstanceResourceList', + 'BackupParameters', + 'BackupPolicy', + 'BackupSchedule', + 'BackupVault', + 'BackupVaultResource', + 'BackupVaultResourceList', + 'BaseBackupPolicy', + 'BaseBackupPolicyResource', + 'BaseBackupPolicyResourceList', + 'BasePolicyRule', + 'CheckNameAvailabilityRequest', + 'CheckNameAvailabilityResult', + 'ClientDiscoveryDisplay', + 'ClientDiscoveryForLogSpecification', + 'ClientDiscoveryForProperties', + 'ClientDiscoveryForServiceSpecification', + 'ClientDiscoveryResponse', + 'ClientDiscoveryValueForSingleApi', + 'CopyOnExpiryOption', + 'CopyOption', + 'CustomCopyOption', + 'DataStoreInfoBase', + 'DataStoreParameters', + 'Datasource', + 'DatasourceSet', + 'Day', + 'DeleteOption', + 'DppBaseResource', + 'DppBaseResourceList', + 'DppIdentityDetails', + 'DppResource', + 'DppResourceList', + 'DppTrackedResource', + 'DppTrackedResourceList', + 'DppWorkerRequest', + 'Error', + 'ErrorAdditionalInfo', + 'ExportJobsResult', + 'FeatureValidationRequest', + 'FeatureValidationRequestBase', + 'FeatureValidationResponse', + 'FeatureValidationResponseBase', + 'ImmediateCopyOption', + 'InnerError', + 'ItemLevelRestoreCriteria', + 'ItemLevelRestoreTargetInfo', + 'JobExtendedInfo', + 'JobSubTask', + 'OperationExtendedInfo', + 'OperationJobExtendedInfo', + 'OperationResource', + 'PatchResourceRequestInput', + 'PolicyInfo', + 'PolicyParameters', + 'ProtectionStatusDetails', + 'RangeBasedItemLevelRestoreCriteria', + 'RecoveryPointDataStoreDetails', + 'RecoveryPointsFilters', + 'ResourceGuard', + 'ResourceGuardOperation', + 'ResourceGuardResource', + 'ResourceGuardResourceList', + 'ResourceMoveDetails', + 'RestorableTimeRange', + 'RestoreFilesTargetInfo', + 'RestoreJobRecoveryPointDetails', + 'RestoreTargetInfo', + 'RestoreTargetInfoBase', + 'RetentionTag', + 'ScheduleBasedBackupCriteria', + 'ScheduleBasedTriggerContext', + 'SecretStoreBasedAuthCredentials', + 'SecretStoreResource', + 'SourceLifeCycle', + 'StorageSetting', + 'SupportedFeature', + 'SystemData', + 'TaggingCriteria', + 'TargetCopySetting', + 'TargetDetails', + 'TriggerBackupRequest', + 'TriggerContext', + 'UserFacingError', + 'ValidateForBackupRequest', + 'ValidateRestoreRequestObject', + 'AbsoluteMarker', + 'CreatedByType', + 'CurrentProtectionState', + 'DataStoreTypes', + 'DayOfWeek', + 'FeatureSupportStatus', + 'FeatureType', + 'Month', + 'ProvisioningState', + 'RecoveryOption', + 'RehydrationPriority', + 'RehydrationStatus', + 'ResourceMoveState', + 'RestoreSourceDataStoreType', + 'RestoreTargetLocationType', + 'SecretStoreType', + 'SourceDataStoreType', + 'Status', + 'StorageSettingStoreTypes', + 'StorageSettingTypes', + '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 new file mode 100644 index 000000000000..926803c67b2c --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/_data_protection_client_enums.py @@ -0,0 +1,226 @@ +# 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 enum import Enum, EnumMeta +from six import with_metaclass + +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)): + + ALL_BACKUP = "AllBackup" + FIRST_OF_DAY = "FirstOfDay" + FIRST_OF_MONTH = "FirstOfMonth" + FIRST_OF_WEEK = "FirstOfWeek" + FIRST_OF_YEAR = "FirstOfYear" + +class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity that created the resource. + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + +class CurrentProtectionState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the current protection state of the resource + """ + + INVALID = "Invalid" + NOT_PROTECTED = "NotProtected" + CONFIGURING_PROTECTION = "ConfiguringProtection" + PROTECTION_CONFIGURED = "ProtectionConfigured" + BACKUP_SCHEDULES_SUSPENDED = "BackupSchedulesSuspended" + RETENTION_SCHEDULES_SUSPENDED = "RetentionSchedulesSuspended" + PROTECTION_STOPPED = "ProtectionStopped" + PROTECTION_ERROR = "ProtectionError" + CONFIGURING_PROTECTION_FAILED = "ConfiguringProtectionFailed" + SOFT_DELETING = "SoftDeleting" + SOFT_DELETED = "SoftDeleted" + UPDATING_PROTECTION = "UpdatingProtection" + +class DataStoreTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """type of datastore; Operational/Vault/Archive + """ + + OPERATIONAL_STORE = "OperationalStore" + VAULT_STORE = "VaultStore" + ARCHIVE_STORE = "ArchiveStore" + +class DayOfWeek(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + FRIDAY = "Friday" + MONDAY = "Monday" + SATURDAY = "Saturday" + SUNDAY = "Sunday" + THURSDAY = "Thursday" + TUESDAY = "Tuesday" + WEDNESDAY = "Wednesday" + +class FeatureSupportStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """feature support status + """ + + INVALID = "Invalid" + NOT_SUPPORTED = "NotSupported" + ALPHA_PREVIEW = "AlphaPreview" + PRIVATE_PREVIEW = "PrivatePreview" + PUBLIC_PREVIEW = "PublicPreview" + GENERALLY_AVAILABLE = "GenerallyAvailable" + +class FeatureType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """backup support feature type. + """ + + INVALID = "Invalid" + DATA_SOURCE_TYPE = "DataSourceType" + +class Month(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + APRIL = "April" + AUGUST = "August" + DECEMBER = "December" + FEBRUARY = "February" + JANUARY = "January" + JULY = "July" + JUNE = "June" + MARCH = "March" + MAY = "May" + NOVEMBER = "November" + OCTOBER = "October" + SEPTEMBER = "September" + +class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the BackupVault resource + """ + + FAILED = "Failed" + PROVISIONING = "Provisioning" + SUCCEEDED = "Succeeded" + UNKNOWN = "Unknown" + UPDATING = "Updating" + +class RecoveryOption(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Recovery Option + """ + + FAIL_IF_EXISTS = "FailIfExists" + +class RehydrationPriority(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Priority to be used for rehydration. Values High or Standard + """ + + INVALID = "Invalid" + HIGH = "High" + STANDARD = "Standard" + +class RehydrationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + CREATE_IN_PROGRESS = "CREATE_IN_PROGRESS" + COMPLETED = "COMPLETED" + DELETE_IN_PROGRESS = "DELETE_IN_PROGRESS" + DELETED = "DELETED" + FAILED = "FAILED" + +class ResourceMoveState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Resource move state for backup vault + """ + + UNKNOWN = "Unknown" + IN_PROGRESS = "InProgress" + PREPARE_FAILED = "PrepareFailed" + COMMIT_FAILED = "CommitFailed" + FAILED = "Failed" + PREPARE_TIMEDOUT = "PrepareTimedout" + COMMIT_TIMEDOUT = "CommitTimedout" + CRITICAL_FAILURE = "CriticalFailure" + PARTIAL_SUCCESS = "PartialSuccess" + MOVE_SUCCEEDED = "MoveSucceeded" + +class RestoreSourceDataStoreType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Gets or sets the type of the source data store. + """ + + OPERATIONAL_STORE = "OperationalStore" + VAULT_STORE = "VaultStore" + ARCHIVE_STORE = "ArchiveStore" + +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} + """ + + INVALID = "Invalid" + AZURE_BLOBS = "AzureBlobs" + AZURE_FILES = "AzureFiles" + +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)): + """Gets or sets the type of the source data store. + """ + + ARCHIVE_STORE = "ArchiveStore" + SNAPSHOT_STORE = "SnapshotStore" + VAULT_STORE = "VaultStore" + +class Status(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the protection status of the resource + """ + + CONFIGURING_PROTECTION = "ConfiguringProtection" + CONFIGURING_PROTECTION_FAILED = "ConfiguringProtectionFailed" + PROTECTION_CONFIGURED = "ProtectionConfigured" + PROTECTION_STOPPED = "ProtectionStopped" + SOFT_DELETED = "SoftDeleted" + SOFT_DELETING = "SoftDeleting" + +class StorageSettingStoreTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Gets or sets the type of the datastore. + """ + + ARCHIVE_STORE = "ArchiveStore" + SNAPSHOT_STORE = "SnapshotStore" + VAULT_STORE = "VaultStore" + +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)): + + FIRST = "First" + FOURTH = "Fourth" + LAST = "Last" + SECOND = "Second" + THIRD = "Third" 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 new file mode 100644 index 000000000000..459c310a482e --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/_models.py @@ -0,0 +1,4205 @@ +# 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 new file mode 100644 index 000000000000..27867c12c61d --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/_models_py3.py @@ -0,0 +1,4595 @@ +# 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 datetime +from typing import Dict, List, Optional, Union + +import msrest.serialization + +from ._data_protection_client_enums import * + + +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, + *, + duration: str, + **kwargs + ): + super(DeleteOption, self).__init__(**kwargs) + self.duration = 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, + *, + duration: str, + **kwargs + ): + super(AbsoluteDeleteOption, self).__init__(duration=duration, **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, + *, + rule_name: str, + trigger_option: "AdhocBackupTriggerOption", + **kwargs + ): + super(AdHocBackupRuleOptions, self).__init__(**kwargs) + self.rule_name = rule_name + self.trigger_option = 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, + *, + retention_tag_override: Optional[str] = None, + **kwargs + ): + super(AdhocBackupTriggerOption, self).__init__(**kwargs) + self.retention_tag_override = retention_tag_override + + +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, + *, + tag_info: Optional["RetentionTag"] = None, + **kwargs + ): + super(AdhocBasedTaggingCriteria, self).__init__(**kwargs) + self.tag_info = tag_info + + +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, + *, + tagging_criteria: "AdhocBasedTaggingCriteria", + **kwargs + ): + super(AdhocBasedTriggerContext, self).__init__(**kwargs) + self.object_type = 'AdhocBasedTriggerContext' # type: str + self.tagging_criteria = 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, + *, + recovery_point_time: datetime.datetime, + friendly_name: Optional[str] = None, + recovery_point_data_stores_details: Optional[List["RecoveryPointDataStoreDetails"]] = None, + policy_name: Optional[str] = None, + policy_version: Optional[str] = None, + recovery_point_id: Optional[str] = None, + recovery_point_type: Optional[str] = None, + retention_tag_name: Optional[str] = None, + retention_tag_version: Optional[str] = None, + **kwargs + ): + super(AzureBackupDiscreteRecoveryPoint, self).__init__(**kwargs) + self.object_type = 'AzureBackupDiscreteRecoveryPoint' # type: str + self.friendly_name = friendly_name + self.recovery_point_data_stores_details = recovery_point_data_stores_details + self.recovery_point_time = recovery_point_time + self.policy_name = policy_name + self.policy_version = policy_version + self.recovery_point_id = recovery_point_id + self.recovery_point_type = recovery_point_type + self.retention_tag_name = retention_tag_name + self.retention_tag_version = retention_tag_version + + +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, + *, + source_data_store_type: Union[str, "RestoreSourceDataStoreType"], + start_time: Optional[str] = None, + end_time: Optional[str] = None, + **kwargs + ): + super(AzureBackupFindRestorableTimeRangesRequest, self).__init__(**kwargs) + self.source_data_store_type = source_data_store_type + self.start_time = start_time + self.end_time = end_time + + +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, + *, + subscription_id: Optional[str] = None, + uri: Optional[str] = None, + headers: Optional[Dict[str, List[str]]] = None, + supported_group_versions: Optional[List[str]] = None, + culture_info: Optional[str] = None, + parameters: Optional[Dict[str, str]] = None, + http_method: Optional[str] = None, + **kwargs + ): + super(DppWorkerRequest, self).__init__(**kwargs) + self.subscription_id = subscription_id + self.uri = uri + self.headers = headers + self.supported_group_versions = supported_group_versions + self.culture_info = culture_info + self.parameters = parameters + self.http_method = http_method + + +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, + *, + subscription_id: Optional[str] = None, + uri: Optional[str] = None, + headers: Optional[Dict[str, List[str]]] = None, + supported_group_versions: Optional[List[str]] = None, + culture_info: Optional[str] = None, + parameters: Optional[Dict[str, str]] = None, + http_method: Optional[str] = None, + content: Optional["AzureBackupFindRestorableTimeRangesRequest"] = None, + **kwargs + ): + 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 + + +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, + *, + restorable_time_ranges: Optional[List["RestorableTimeRange"]] = None, + object_type: Optional[str] = None, + **kwargs + ): + super(AzureBackupFindRestorableTimeRangesResponse, self).__init__(**kwargs) + self.restorable_time_ranges = restorable_time_ranges + self.object_type = object_type + + +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, + *, + properties: Optional["AzureBackupFindRestorableTimeRangesResponse"] = None, + **kwargs + ): + super(AzureBackupFindRestorableTimeRangesResponseResource, self).__init__(**kwargs) + self.properties = properties + + +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, + *, + activity_id: str, + backup_instance_friendly_name: str, + data_source_id: str, + data_source_location: str, + data_source_name: str, + data_source_type: str, + is_user_triggered: bool, + operation: str, + operation_category: str, + progress_enabled: bool, + source_resource_group: str, + source_subscription_id: str, + start_time: datetime.datetime, + status: str, + subscription_id: str, + supported_actions: List[str], + vault_name: str, + data_source_set_name: Optional[str] = None, + duration: Optional[str] = None, + etag: Optional[str] = None, + source_data_store_name: Optional[str] = None, + destination_data_store_name: Optional[str] = None, + **kwargs + ): + super(AzureBackupJob, self).__init__(**kwargs) + self.activity_id = activity_id + self.backup_instance_friendly_name = backup_instance_friendly_name + self.backup_instance_id = None + self.data_source_id = data_source_id + self.data_source_location = data_source_location + self.data_source_name = data_source_name + self.data_source_set_name = data_source_set_name + self.data_source_type = data_source_type + self.duration = duration + self.end_time = None + self.error_details = None + self.extended_info = None + self.is_user_triggered = is_user_triggered + self.operation = operation + self.operation_category = operation_category + self.policy_id = None + self.policy_name = None + self.progress_enabled = progress_enabled + self.progress_url = None + self.restore_type = None + self.source_resource_group = source_resource_group + self.source_subscription_id = source_subscription_id + self.start_time = start_time + self.status = status + self.subscription_id = subscription_id + self.supported_actions = supported_actions + self.vault_name = vault_name + self.etag = etag + self.source_data_store_name = source_data_store_name + self.destination_data_store_name = destination_data_store_name + + +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, + *, + properties: Optional["AzureBackupJob"] = None, + **kwargs + ): + super(AzureBackupJobResource, self).__init__(**kwargs) + self.properties = properties + + +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, + *, + next_link: Optional[str] = None, + **kwargs + ): + super(DppResourceList, self).__init__(**kwargs) + self.next_link = next_link + + +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, + *, + next_link: Optional[str] = None, + value: Optional[List["AzureBackupJobResource"]] = None, + **kwargs + ): + super(AzureBackupJobResourceList, self).__init__(next_link=next_link, **kwargs) + self.value = value + + +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, + *, + backup_type: str, + **kwargs + ): + super(AzureBackupParams, self).__init__(**kwargs) + self.object_type = 'AzureBackupParams' # type: str + self.backup_type = 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, + *, + restore_target_info: "RestoreTargetInfoBase", + source_data_store_type: Union[str, "SourceDataStoreType"], + **kwargs + ): + 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 + + +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, + *, + restore_target_info: "RestoreTargetInfoBase", + source_data_store_type: Union[str, "SourceDataStoreType"], + recovery_point_id: str, + **kwargs + ): + super(AzureBackupRecoveryPointBasedRestoreRequest, self).__init__(restore_target_info=restore_target_info, source_data_store_type=source_data_store_type, **kwargs) + self.object_type = 'AzureBackupRecoveryPointBasedRestoreRequest' # type: str + self.recovery_point_id = 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, + *, + properties: Optional["AzureBackupRecoveryPoint"] = None, + **kwargs + ): + super(AzureBackupRecoveryPointResource, self).__init__(**kwargs) + self.properties = properties + + +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, + *, + next_link: Optional[str] = None, + value: Optional[List["AzureBackupRecoveryPointResource"]] = None, + **kwargs + ): + super(AzureBackupRecoveryPointResourceList, self).__init__(next_link=next_link, **kwargs) + self.value = value + + +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, + *, + restore_target_info: "RestoreTargetInfoBase", + source_data_store_type: Union[str, "SourceDataStoreType"], + recovery_point_time: str, + **kwargs + ): + super(AzureBackupRecoveryTimeBasedRestoreRequest, self).__init__(restore_target_info=restore_target_info, source_data_store_type=source_data_store_type, **kwargs) + self.object_type = 'AzureBackupRecoveryTimeBasedRestoreRequest' # type: str + self.recovery_point_time = 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, + *, + recovery_point_id: str, + rehydration_retention_duration: str, + rehydration_priority: Optional[Union[str, "RehydrationPriority"]] = None, + **kwargs + ): + super(AzureBackupRehydrationRequest, self).__init__(**kwargs) + self.recovery_point_id = recovery_point_id + self.rehydration_priority = rehydration_priority + self.rehydration_retention_duration = 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, + *, + restore_target_info: "RestoreTargetInfoBase", + source_data_store_type: Union[str, "SourceDataStoreType"], + recovery_point_id: str, + rehydration_priority: Union[str, "RehydrationPriority"], + rehydration_retention_duration: str, + **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) + self.object_type = 'AzureBackupRestoreWithRehydrationRequest' # type: str + self.rehydration_priority = rehydration_priority + self.rehydration_retention_duration = 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, + *, + name: str, + **kwargs + ): + super(BasePolicyRule, self).__init__(**kwargs) + self.name = 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, + *, + name: str, + data_store: "DataStoreInfoBase", + trigger: "TriggerContext", + backup_parameters: Optional["BackupParameters"] = None, + **kwargs + ): + super(AzureBackupRule, self).__init__(name=name, **kwargs) + self.object_type = 'AzureBackupRule' # type: str + self.backup_parameters = backup_parameters + self.data_store = data_store + self.trigger = 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, + *, + data_store_type: Union[str, "DataStoreTypes"], + **kwargs + ): + super(DataStoreParameters, self).__init__(**kwargs) + self.object_type = None # type: Optional[str] + self.data_store_type = 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, + *, + data_store_type: Union[str, "DataStoreTypes"], + resource_group_id: Optional[str] = None, + **kwargs + ): + super(AzureOperationalStoreParameters, self).__init__(data_store_type=data_store_type, **kwargs) + self.object_type = 'AzureOperationalStoreParameters' # type: str + self.resource_group_id = resource_group_id + + +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, + *, + name: str, + lifecycles: List["SourceLifeCycle"], + is_default: Optional[bool] = None, + **kwargs + ): + super(AzureRetentionRule, self).__init__(name=name, **kwargs) + self.object_type = 'AzureRetentionRule' # type: str + self.is_default = is_default + self.lifecycles = 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, + *, + data_source_info: "Datasource", + policy_info: "PolicyInfo", + object_type: str, + friendly_name: Optional[str] = None, + data_source_set_info: Optional["DatasourceSet"] = None, + datasource_auth_credentials: Optional["AuthCredentials"] = None, + **kwargs + ): + super(BackupInstance, self).__init__(**kwargs) + self.friendly_name = friendly_name + self.data_source_info = data_source_info + self.data_source_set_info = data_source_set_info + self.policy_info = policy_info + self.protection_status = None + self.current_protection_state = None + self.protection_error_details = None + self.provisioning_state = None + self.datasource_auth_credentials = datasource_auth_credentials + self.object_type = 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, + *, + properties: Optional["BackupInstance"] = None, + **kwargs + ): + super(BackupInstanceResource, self).__init__(**kwargs) + self.properties = properties + + +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, + *, + next_link: Optional[str] = None, + value: Optional[List["BackupInstanceResource"]] = None, + **kwargs + ): + super(BackupInstanceResourceList, self).__init__(next_link=next_link, **kwargs) + self.value = value + + +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, + *, + datasource_types: List[str], + **kwargs + ): + super(BaseBackupPolicy, self).__init__(**kwargs) + self.datasource_types = 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, + *, + datasource_types: List[str], + policy_rules: List["BasePolicyRule"], + **kwargs + ): + super(BackupPolicy, self).__init__(datasource_types=datasource_types, **kwargs) + self.object_type = 'BackupPolicy' # type: str + self.policy_rules = 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, + *, + repeating_time_intervals: List[str], + time_zone: Optional[str] = None, + **kwargs + ): + super(BackupSchedule, self).__init__(**kwargs) + self.repeating_time_intervals = repeating_time_intervals + self.time_zone = time_zone + + +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, + *, + storage_settings: List["StorageSetting"], + **kwargs + ): + super(BackupVault, self).__init__(**kwargs) + self.provisioning_state = None + self.resource_move_state = None + self.resource_move_details = None + self.storage_settings = 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, + *, + e_tag: Optional[str] = None, + identity: Optional["DppIdentityDetails"] = None, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(DppTrackedResource, self).__init__(**kwargs) + self.e_tag = e_tag + self.id = None + self.identity = identity + self.location = location + self.name = None + self.tags = tags + 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, + *, + properties: "BackupVault", + e_tag: Optional[str] = None, + identity: Optional["DppIdentityDetails"] = None, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(BackupVaultResource, self).__init__(e_tag=e_tag, identity=identity, location=location, tags=tags, **kwargs) + self.properties = 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, + *, + next_link: Optional[str] = None, + value: Optional[List["BackupVaultResource"]] = None, + **kwargs + ): + super(BackupVaultResourceList, self).__init__(next_link=next_link, **kwargs) + self.value = value + + +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, + *, + properties: Optional["BaseBackupPolicy"] = None, + **kwargs + ): + super(BaseBackupPolicyResource, self).__init__(**kwargs) + self.properties = properties + + +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, + *, + next_link: Optional[str] = None, + value: Optional[List["BaseBackupPolicyResource"]] = None, + **kwargs + ): + super(BaseBackupPolicyResourceList, self).__init__(next_link=next_link, **kwargs) + self.value = value + + +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, + *, + name: Optional[str] = None, + type: Optional[str] = None, + **kwargs + ): + super(CheckNameAvailabilityRequest, self).__init__(**kwargs) + self.name = name + self.type = type + + +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, + *, + message: Optional[str] = None, + name_available: Optional[bool] = None, + reason: Optional[str] = None, + **kwargs + ): + super(CheckNameAvailabilityResult, self).__init__(**kwargs) + self.message = message + self.name_available = name_available + self.reason = reason + + +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, + *, + description: Optional[str] = None, + operation: Optional[str] = None, + provider: Optional[str] = None, + resource: Optional[str] = None, + **kwargs + ): + super(ClientDiscoveryDisplay, self).__init__(**kwargs) + self.description = description + self.operation = operation + self.provider = provider + self.resource = resource + + +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, + *, + blob_duration: Optional[str] = None, + display_name: Optional[str] = None, + name: Optional[str] = None, + **kwargs + ): + super(ClientDiscoveryForLogSpecification, self).__init__(**kwargs) + self.blob_duration = blob_duration + self.display_name = display_name + self.name = name + + +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, + *, + service_specification: Optional["ClientDiscoveryForServiceSpecification"] = None, + **kwargs + ): + super(ClientDiscoveryForProperties, self).__init__(**kwargs) + self.service_specification = service_specification + + +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, + *, + log_specifications: Optional[List["ClientDiscoveryForLogSpecification"]] = None, + **kwargs + ): + super(ClientDiscoveryForServiceSpecification, self).__init__(**kwargs) + self.log_specifications = log_specifications + + +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, + *, + next_link: Optional[str] = None, + value: Optional[List["ClientDiscoveryValueForSingleApi"]] = None, + **kwargs + ): + super(ClientDiscoveryResponse, self).__init__(**kwargs) + self.next_link = next_link + self.value = value + + +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, + *, + display: Optional["ClientDiscoveryDisplay"] = None, + name: Optional[str] = None, + is_data_action: Optional[bool] = None, + origin: Optional[str] = None, + properties: Optional["ClientDiscoveryForProperties"] = None, + **kwargs + ): + super(ClientDiscoveryValueForSingleApi, self).__init__(**kwargs) + self.display = display + self.name = name + self.is_data_action = is_data_action + self.origin = origin + self.properties = properties + + +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, + *, + duration: Optional[str] = None, + **kwargs + ): + super(CustomCopyOption, self).__init__(**kwargs) + self.object_type = 'CustomCopyOption' # type: str + self.duration = duration + + +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, + *, + resource_id: str, + datasource_type: Optional[str] = None, + object_type: Optional[str] = None, + resource_location: Optional[str] = None, + resource_name: Optional[str] = None, + resource_type: Optional[str] = None, + resource_uri: Optional[str] = None, + **kwargs + ): + super(Datasource, self).__init__(**kwargs) + self.datasource_type = datasource_type + self.object_type = object_type + self.resource_id = resource_id + self.resource_location = resource_location + self.resource_name = resource_name + self.resource_type = resource_type + self.resource_uri = resource_uri + + +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, + *, + resource_id: str, + datasource_type: Optional[str] = None, + object_type: Optional[str] = None, + resource_location: Optional[str] = None, + resource_name: Optional[str] = None, + resource_type: Optional[str] = None, + resource_uri: Optional[str] = None, + **kwargs + ): + super(DatasourceSet, self).__init__(**kwargs) + self.datasource_type = datasource_type + self.object_type = object_type + self.resource_id = resource_id + self.resource_location = resource_location + self.resource_name = resource_name + self.resource_type = resource_type + self.resource_uri = resource_uri + + +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, + *, + data_store_type: Union[str, "DataStoreTypes"], + object_type: str, + **kwargs + ): + super(DataStoreInfoBase, self).__init__(**kwargs) + self.data_store_type = data_store_type + self.object_type = 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, + *, + date: Optional[int] = None, + is_last: Optional[bool] = None, + **kwargs + ): + super(Day, self).__init__(**kwargs) + self.date = date + self.is_last = is_last + + +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, + *, + value: Optional[List["DppBaseResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(DppBaseResourceList, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +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, + *, + type: Optional[str] = None, + **kwargs + ): + super(DppIdentityDetails, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + + +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, + *, + next_link: Optional[str] = None, + **kwargs + ): + super(DppTrackedResourceList, self).__init__(**kwargs) + self.next_link = next_link + + +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, + *, + feature_type: Optional[Union[str, "FeatureType"]] = None, + feature_name: Optional[str] = None, + **kwargs + ): + super(FeatureValidationRequest, self).__init__(**kwargs) + self.object_type = 'FeatureValidationRequest' # type: str + self.feature_type = feature_type + self.feature_name = feature_name + + +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, + *, + feature_type: Optional[Union[str, "FeatureType"]] = None, + features: Optional[List["SupportedFeature"]] = None, + **kwargs + ): + super(FeatureValidationResponse, self).__init__(**kwargs) + self.object_type = 'FeatureValidationResponse' # type: str + self.feature_type = feature_type + self.features = features + + +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, + *, + additional_info: Optional[Dict[str, str]] = None, + code: Optional[str] = None, + embedded_inner_error: Optional["InnerError"] = None, + **kwargs + ): + super(InnerError, self).__init__(**kwargs) + self.additional_info = additional_info + self.code = code + self.embedded_inner_error = embedded_inner_error + + +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, + *, + recovery_option: Union[str, "RecoveryOption"], + restore_location: Optional[str] = None, + **kwargs + ): + super(RestoreTargetInfoBase, self).__init__(**kwargs) + self.object_type = None # type: Optional[str] + self.recovery_option = recovery_option + self.restore_location = restore_location + + +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, + *, + recovery_option: Union[str, "RecoveryOption"], + restore_criteria: List["ItemLevelRestoreCriteria"], + datasource_info: "Datasource", + restore_location: Optional[str] = None, + datasource_set_info: Optional["DatasourceSet"] = None, + datasource_auth_credentials: Optional["AuthCredentials"] = None, + **kwargs + ): + super(ItemLevelRestoreTargetInfo, self).__init__(recovery_option=recovery_option, restore_location=restore_location, **kwargs) + self.object_type = 'ItemLevelRestoreTargetInfo' # type: str + self.restore_criteria = restore_criteria + self.datasource_info = datasource_info + self.datasource_set_info = datasource_set_info + self.datasource_auth_credentials = datasource_auth_credentials + + +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, + *, + additional_details: Optional[Dict[str, str]] = None, + **kwargs + ): + super(JobExtendedInfo, self).__init__(**kwargs) + self.additional_details = additional_details + 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, + *, + task_id: int, + task_name: str, + task_status: str, + additional_details: Optional[Dict[str, str]] = None, + **kwargs + ): + super(JobSubTask, self).__init__(**kwargs) + self.additional_details = additional_details + self.task_id = task_id + self.task_name = task_name + self.task_progress = None + self.task_status = 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, + *, + job_id: Optional[str] = None, + **kwargs + ): + super(OperationJobExtendedInfo, self).__init__(**kwargs) + self.object_type = 'OperationJobExtendedInfo' # type: str + self.job_id = job_id + + +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, + *, + end_time: Optional[datetime.datetime] = None, + error: Optional["Error"] = None, + id: Optional[str] = None, + name: Optional[str] = None, + properties: Optional["OperationExtendedInfo"] = None, + start_time: Optional[datetime.datetime] = None, + status: Optional[str] = None, + **kwargs + ): + super(OperationResource, self).__init__(**kwargs) + self.end_time = end_time + self.error = error + self.id = id + self.name = name + self.properties = properties + self.start_time = start_time + self.status = status + + +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, + *, + identity: Optional["DppIdentityDetails"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(PatchResourceRequestInput, self).__init__(**kwargs) + self.identity = identity + self.tags = tags + + +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, + *, + policy_id: str, + policy_parameters: Optional["PolicyParameters"] = None, + **kwargs + ): + super(PolicyInfo, self).__init__(**kwargs) + self.policy_id = policy_id + self.policy_version = None + self.policy_parameters = policy_parameters + + +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, + *, + data_store_parameters_list: Optional[List["DataStoreParameters"]] = None, + **kwargs + ): + super(PolicyParameters, self).__init__(**kwargs) + self.data_store_parameters_list = data_store_parameters_list + + +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, + *, + error_details: Optional["UserFacingError"] = None, + status: Optional[Union[str, "Status"]] = None, + **kwargs + ): + super(ProtectionStatusDetails, self).__init__(**kwargs) + self.error_details = error_details + self.status = status + + +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, + *, + min_matching_value: Optional[str] = None, + max_matching_value: Optional[str] = None, + **kwargs + ): + super(RangeBasedItemLevelRestoreCriteria, self).__init__(**kwargs) + self.object_type = 'RangeBasedItemLevelRestoreCriteria' # type: str + self.min_matching_value = min_matching_value + self.max_matching_value = max_matching_value + + +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, + *, + creation_time: Optional[datetime.datetime] = None, + expiry_time: Optional[datetime.datetime] = None, + id: Optional[str] = None, + meta_data: Optional[str] = None, + state: Optional[str] = None, + type: Optional[str] = None, + visible: Optional[bool] = None, + **kwargs + ): + super(RecoveryPointDataStoreDetails, self).__init__(**kwargs) + self.creation_time = creation_time + self.expiry_time = expiry_time + self.id = id + self.meta_data = meta_data + self.state = state + self.type = type + self.visible = visible + 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, + *, + restore_point_data_store_id: Optional[str] = None, + is_visible: Optional[bool] = None, + start_date: Optional[str] = None, + end_date: Optional[str] = None, + extended_info: Optional[bool] = None, + restore_point_state: Optional[str] = None, + **kwargs + ): + super(RecoveryPointsFilters, self).__init__(**kwargs) + self.restore_point_data_store_id = restore_point_data_store_id + self.is_visible = is_visible + self.start_date = start_date + self.end_date = end_date + self.extended_info = extended_info + self.restore_point_state = restore_point_state + + +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, + *, + e_tag: Optional[str] = None, + identity: Optional["DppIdentityDetails"] = None, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + properties: Optional["ResourceGuard"] = None, + **kwargs + ): + super(ResourceGuardResource, self).__init__(e_tag=e_tag, identity=identity, location=location, tags=tags, **kwargs) + self.properties = properties + + +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, + *, + next_link: Optional[str] = None, + value: Optional[List["ResourceGuardResource"]] = None, + **kwargs + ): + super(ResourceGuardResourceList, self).__init__(next_link=next_link, **kwargs) + self.value = value + + +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, + *, + operation_id: Optional[str] = None, + start_time_utc: Optional[str] = None, + completion_time_utc: Optional[str] = None, + source_resource_path: Optional[str] = None, + target_resource_path: Optional[str] = None, + **kwargs + ): + super(ResourceMoveDetails, self).__init__(**kwargs) + self.operation_id = operation_id + self.start_time_utc = start_time_utc + self.completion_time_utc = completion_time_utc + self.source_resource_path = source_resource_path + self.target_resource_path = target_resource_path + + +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, + *, + start_time: str, + end_time: str, + object_type: Optional[str] = None, + **kwargs + ): + super(RestorableTimeRange, self).__init__(**kwargs) + self.start_time = start_time + self.end_time = end_time + self.object_type = object_type + + +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, + *, + recovery_option: Union[str, "RecoveryOption"], + target_details: "TargetDetails", + restore_location: Optional[str] = None, + **kwargs + ): + super(RestoreFilesTargetInfo, self).__init__(recovery_option=recovery_option, restore_location=restore_location, **kwargs) + self.object_type = 'RestoreFilesTargetInfo' # type: str + self.target_details = 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, + *, + recovery_point_id: Optional[str] = None, + recovery_point_time: Optional[datetime.datetime] = None, + **kwargs + ): + super(RestoreJobRecoveryPointDetails, self).__init__(**kwargs) + self.recovery_point_id = recovery_point_id + self.recovery_point_time = recovery_point_time + + +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, + *, + recovery_option: Union[str, "RecoveryOption"], + datasource_info: "Datasource", + restore_location: Optional[str] = None, + datasource_set_info: Optional["DatasourceSet"] = None, + datasource_auth_credentials: Optional["AuthCredentials"] = None, + **kwargs + ): + super(RestoreTargetInfo, self).__init__(recovery_option=recovery_option, restore_location=restore_location, **kwargs) + self.object_type = 'RestoreTargetInfo' # type: str + self.datasource_info = datasource_info + self.datasource_set_info = datasource_set_info + self.datasource_auth_credentials = datasource_auth_credentials + + +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, + *, + tag_name: str, + **kwargs + ): + super(RetentionTag, self).__init__(**kwargs) + self.e_tag = None + self.id = None + self.tag_name = 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, + *, + absolute_criteria: Optional[List[Union[str, "AbsoluteMarker"]]] = None, + days_of_month: Optional[List["Day"]] = None, + days_of_the_week: Optional[List[Union[str, "DayOfWeek"]]] = None, + months_of_year: Optional[List[Union[str, "Month"]]] = None, + schedule_times: Optional[List[datetime.datetime]] = None, + weeks_of_the_month: Optional[List[Union[str, "WeekNumber"]]] = None, + **kwargs + ): + super(ScheduleBasedBackupCriteria, self).__init__(**kwargs) + self.object_type = 'ScheduleBasedBackupCriteria' # type: str + self.absolute_criteria = absolute_criteria + self.days_of_month = days_of_month + self.days_of_the_week = days_of_the_week + self.months_of_year = months_of_year + self.schedule_times = schedule_times + self.weeks_of_the_month = weeks_of_the_month + + +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, + *, + schedule: "BackupSchedule", + tagging_criteria: List["TaggingCriteria"], + **kwargs + ): + super(ScheduleBasedTriggerContext, self).__init__(**kwargs) + self.object_type = 'ScheduleBasedTriggerContext' # type: str + self.schedule = schedule + self.tagging_criteria = 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, + *, + secret_store_resource: Optional["SecretStoreResource"] = None, + **kwargs + ): + super(SecretStoreBasedAuthCredentials, self).__init__(**kwargs) + self.object_type = 'SecretStoreBasedAuthCredentials' # type: str + self.secret_store_resource = secret_store_resource + + +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, + *, + secret_store_type: Union[str, "SecretStoreType"], + uri: Optional[str] = None, + **kwargs + ): + super(SecretStoreResource, self).__init__(**kwargs) + self.uri = uri + self.secret_store_type = 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, + *, + delete_after: "DeleteOption", + source_data_store: "DataStoreInfoBase", + target_data_store_copy_settings: Optional[List["TargetCopySetting"]] = None, + **kwargs + ): + super(SourceLifeCycle, self).__init__(**kwargs) + self.delete_after = delete_after + self.source_data_store = source_data_store + self.target_data_store_copy_settings = target_data_store_copy_settings + + +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, + *, + datastore_type: Optional[Union[str, "StorageSettingStoreTypes"]] = None, + type: Optional[Union[str, "StorageSettingTypes"]] = None, + **kwargs + ): + super(StorageSetting, self).__init__(**kwargs) + self.datastore_type = datastore_type + self.type = type + + +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, + *, + feature_name: Optional[str] = None, + support_status: Optional[Union[str, "FeatureSupportStatus"]] = None, + exposure_controlled_features: Optional[List[str]] = None, + **kwargs + ): + super(SupportedFeature, self).__init__(**kwargs) + self.feature_name = feature_name + self.support_status = support_status + self.exposure_controlled_features = exposure_controlled_features + + +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, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs + ): + super(SystemData, self).__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +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, + *, + is_default: bool, + tagging_priority: int, + tag_info: "RetentionTag", + criteria: Optional[List["BackupCriteria"]] = None, + **kwargs + ): + super(TaggingCriteria, self).__init__(**kwargs) + self.criteria = criteria + self.is_default = is_default + self.tagging_priority = tagging_priority + self.tag_info = 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, + *, + copy_after: "CopyOption", + data_store: "DataStoreInfoBase", + **kwargs + ): + super(TargetCopySetting, self).__init__(**kwargs) + self.copy_after = copy_after + self.data_store = 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, + *, + file_prefix: str, + restore_target_location_type: Union[str, "RestoreTargetLocationType"], + url: str, + **kwargs + ): + super(TargetDetails, self).__init__(**kwargs) + self.file_prefix = file_prefix + self.restore_target_location_type = restore_target_location_type + self.url = 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, + *, + backup_rule_options: "AdHocBackupRuleOptions", + **kwargs + ): + super(TriggerBackupRequest, self).__init__(**kwargs) + self.backup_rule_options = 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, + *, + code: Optional[str] = None, + details: Optional[List["UserFacingError"]] = None, + inner_error: Optional["InnerError"] = None, + is_retryable: Optional[bool] = None, + is_user_error: Optional[bool] = None, + properties: Optional[Dict[str, str]] = None, + message: Optional[str] = None, + recommended_action: Optional[List[str]] = None, + target: Optional[str] = None, + **kwargs + ): + super(UserFacingError, self).__init__(**kwargs) + self.code = code + self.details = details + self.inner_error = inner_error + self.is_retryable = is_retryable + self.is_user_error = is_user_error + self.properties = properties + self.message = message + self.recommended_action = recommended_action + self.target = target + + +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, + *, + backup_instance: "BackupInstance", + **kwargs + ): + super(ValidateForBackupRequest, self).__init__(**kwargs) + self.backup_instance = 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, + *, + restore_request_object: "AzureBackupRestoreRequest", + **kwargs + ): + 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 new file mode 100644 index 000000000000..f9c765bb82a0 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/__init__.py @@ -0,0 +1,39 @@ +# 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 ._backup_vaults_operations import BackupVaultsOperations +from ._operation_result_operations import OperationResultOperations +from ._operation_status_operations import OperationStatusOperations +from ._backup_vault_operation_results_operations import BackupVaultOperationResultsOperations +from ._data_protection_operations import DataProtectionOperations +from ._data_protection_operations_operations import DataProtectionOperationsOperations +from ._backup_policies_operations import BackupPoliciesOperations +from ._backup_instances_operations import BackupInstancesOperations +from ._recovery_points_operations import RecoveryPointsOperations +from ._jobs_operations import JobsOperations +from ._restorable_time_ranges_operations import RestorableTimeRangesOperations +from ._export_jobs_operations import ExportJobsOperations +from ._export_jobs_operation_result_operations import ExportJobsOperationResultOperations +from ._resource_guards_operations import ResourceGuardsOperations + +__all__ = [ + 'BackupVaultsOperations', + 'OperationResultOperations', + 'OperationStatusOperations', + 'BackupVaultOperationResultsOperations', + 'DataProtectionOperations', + 'DataProtectionOperationsOperations', + 'BackupPoliciesOperations', + 'BackupInstancesOperations', + 'RecoveryPointsOperations', + 'JobsOperations', + 'RestorableTimeRangesOperations', + 'ExportJobsOperations', + 'ExportJobsOperationResultOperations', + 'ResourceGuardsOperations', +] 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 new file mode 100644 index 000000000000..68829a4eb021 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_instances_operations.py @@ -0,0 +1,1136 @@ +# 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 TYPE_CHECKING +import warnings + +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.polling import LROPoller, NoPolling, PollingMethod +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): + """BackupInstancesOperations 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 + + def list( + self, + vault_name, # type: str + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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 + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('BackupInstanceResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(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) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances'} # type: ignore + + def get( + self, + vault_name, # type: str + resource_group_name, # type: str + backup_instance_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_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 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 + :return: BackupInstanceResource, or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.BackupInstanceResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupInstanceResource"] + 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.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') + + # 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) + 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('BackupInstanceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + 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"] + 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) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('BackupInstanceResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('BackupInstanceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}'} # type: ignore + + 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"] + """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 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. + :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) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.BackupInstanceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupInstanceResource"] + 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._create_or_update_initial( + vault_name=vault_name, + resource_group_name=resource_group_name, + backup_instance_name=backup_instance_name, + parameters=parameters, + 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('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) + 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 + ) + 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 + + def _delete_initial( + self, + vault_name, # type: str + resource_group_name, # type: str + backup_instance_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + 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) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}'} # type: ignore + + def begin_delete( + self, + vault_name, # type: str + resource_group_name, # type: str + backup_instance_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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 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. + :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: + """ + 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._delete_initial( + vault_name=vault_name, + resource_group_name=resource_group_name, + backup_instance_name=backup_instance_name, + 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) + 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 + ) + 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 + + 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"] + 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) + 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 + 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 + _adhoc_backup_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/backup'} # type: ignore + + 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"] + """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 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. + :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: + """ + 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._adhoc_backup_initial( + vault_name=vault_name, + resource_group_name=resource_group_name, + backup_instance_name=backup_instance_name, + parameters=parameters, + 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 + + 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) + 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 + ) + 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 + + 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"] + 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) + 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 + 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_backup_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/validateForBackup'} # type: ignore + + 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"] + """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 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. + :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: + """ + 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_backup_initial( + vault_name=vault_name, + resource_group_name=resource_group_name, + parameters=parameters, + 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 + + 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) + 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 + ) + 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 + + def _trigger_rehydrate_initial( + 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] + 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'), + } + 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) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + 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) + + _trigger_rehydrate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/rehydrate'} # type: ignore + + def begin_trigger_rehydrate( + 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] + """rehydrate recovery point for restore for a BackupInstance. + + :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.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. + :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: + """ + 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._trigger_rehydrate_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + parameters=parameters, + 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) + 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 + ) + 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 + + 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"] + 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) + 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 + if response.status_code == 200: + deserialized = self._deserialize('OperationJobExtendedInfo', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _trigger_restore_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/restore'} # type: ignore + + 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"] + """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 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. + :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: + """ + 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._trigger_restore_initial( + vault_name=vault_name, + resource_group_name=resource_group_name, + backup_instance_name=backup_instance_name, + parameters=parameters, + 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 + + 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) + 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 + ) + 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 + + def _validate_for_restore_initial( + 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"]] + 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) + 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 + 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 + + def begin_validate_for_restore( + 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. + + :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. + :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: + """ + 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( + vault_name=vault_name, + resource_group_name=resource_group_name, + backup_instance_name=backup_instance_name, + parameters=parameters, + 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 + + 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) + 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 + ) + 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 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 new file mode 100644 index 000000000000..66ec3395e92e --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_policies_operations.py @@ -0,0 +1,321 @@ +# 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 TYPE_CHECKING +import warnings + +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.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]] + +class BackupPoliciesOperations(object): + """BackupPoliciesOperations 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 + + def list( + self, + vault_name, # type: str + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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 + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('BaseBackupPolicyResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(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) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies'} # type: ignore + + def get( + self, + vault_name, # type: str + resource_group_name, # type: str + backup_policy_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_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 backup_policy_name: + :type backup_policy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BaseBackupPolicyResource, or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.BaseBackupPolicyResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BaseBackupPolicyResource"] + 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.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') + + # 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) + 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('BaseBackupPolicyResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}'} # type: ignore + + 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" + """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 backup_policy_name: Name of the policy. + :type backup_policy_name: str + :param parameters: Request body for operation. + :type parameters: ~azure.mgmt.dataprotection.models.BaseBackupPolicyResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BaseBackupPolicyResource, or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.BaseBackupPolicyResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BaseBackupPolicyResource"] + 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.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) + 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('BaseBackupPolicyResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}'} # type: ignore + + def delete( + self, + vault_name, # type: str + resource_group_name, # type: str + backup_policy_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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 backup_policy_name: + :type backup_policy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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.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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/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 new file mode 100644 index 000000000000..a04e8c5e27a8 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_vault_operation_results_operations.py @@ -0,0 +1,116 @@ +# 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 TYPE_CHECKING +import warnings + +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.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]] + +class BackupVaultOperationResultsOperations(object): + """BackupVaultOperationResultsOperations 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 + + def get( + self, + vault_name, # type: str + resource_group_name, # type: str + operation_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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 operation_id: + :type operation_id: 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 or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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" + 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) + 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 + if response.status_code == 200: + deserialized = self._deserialize('BackupVaultResource', 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 + 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 new file mode 100644 index 000000000000..d7894a30a873 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_vaults_operations.py @@ -0,0 +1,629 @@ +# 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 TYPE_CHECKING +import warnings + +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.polling import LROPoller, NoPolling, PollingMethod +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 BackupVaultsOperations(object): + """BackupVaultsOperations 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 + + def get_in_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> 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) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.BackupVaultResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('BackupVaultResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(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) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + get_in_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/backupVaults'} # type: ignore + + def get_in_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.BackupVaultResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('BackupVaultResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(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) + + 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 + + def get( + self, + vault_name, # type: str + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_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 + :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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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" + 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') + + # 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) + 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('BackupVaultResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + 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" + 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) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('BackupVaultResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('BackupVaultResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}'} # type: ignore + + 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"] + """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 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. + :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) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.BackupVaultResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupVaultResource"] + 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._create_or_update_initial( + vault_name=vault_name, + resource_group_name=resource_group_name, + parameters=parameters, + 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('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) + 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 + ) + 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 + + def delete( + self, + vault_name, # type: str + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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.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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}'} # 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"] + 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) + 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('BackupVaultResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}'} # type: ignore + + def begin_update( + self, + vault_name, # type: str + resource_group_name, # type: str + parameters, # type: "_models.PatchResourceRequestInput" + **kwargs # type: Any + ): + # type: (...) -> 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 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. + :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) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.BackupVaultResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupVaultResource"] + 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._update_initial( + vault_name=vault_name, + resource_group_name=resource_group_name, + parameters=parameters, + 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('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) + 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 + ) + 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 + + def check_name_availability( + self, + resource_group_name, # type: str + location, # type: str + parameters, # type: "_models.CheckNameAvailabilityRequest" + **kwargs # type: Any + ): + # type: (...) -> "_models.CheckNameAvailabilityResult" + """API to check for resource name availability. + + API to check for resource name availability. + + :param resource_group_name: The name of the resource group where the backup vault is present. + :type resource_group_name: str + :param location: The location in which uniqueness will be verified. + :type location: str + :param parameters: Check name availability request. + :type parameters: ~azure.mgmt.dataprotection.models.CheckNameAvailabilityRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult, or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.CheckNameAvailabilityResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] + 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.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) + 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('CheckNameAvailabilityResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + 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 new file mode 100644 index 000000000000..47420332c4c3 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_data_protection_operations.py @@ -0,0 +1,110 @@ +# 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 TYPE_CHECKING +import warnings + +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.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]] + +class DataProtectionOperations(object): + """DataProtectionOperations 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 + + def check_feature_support( + self, + location, # type: str + parameters, # type: "_models.FeatureValidationRequestBase" + **kwargs # type: Any + ): + # type: (...) -> "_models.FeatureValidationResponseBase" + """Validates if a feature is supported. + + Validates if a feature is supported. + + :param location: + :type location: str + :param parameters: Feature support request object. + :type parameters: ~azure.mgmt.dataprotection.models.FeatureValidationRequestBase + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FeatureValidationResponseBase, or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.FeatureValidationResponseBase + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.FeatureValidationResponseBase"] + 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.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) + 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('FeatureValidationResponseBase', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + 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 new file mode 100644 index 000000000000..aa0b0343c117 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_data_protection_operations_operations.py @@ -0,0 +1,109 @@ +# 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 TYPE_CHECKING +import warnings + +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.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]] + +class DataProtectionOperationsOperations(object): + """DataProtectionOperationsOperations 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 + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> 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) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.ClientDiscoveryResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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 = 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) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ClientDiscoveryResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(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) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + 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 new file mode 100644 index 000000000000..a22827dafd75 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_export_jobs_operation_result_operations.py @@ -0,0 +1,112 @@ +# 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 TYPE_CHECKING +import warnings + +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.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]] + +class ExportJobsOperationResultOperations(object): + """ExportJobsOperationResultOperations 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 + + def get( + self, + resource_group_name, # type: str + vault_name, # type: str + operation_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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. + + :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: OperationID which represents the export job. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExportJobsResult, or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.ExportJobsResult or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ExportJobsResult"]] + 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.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) + 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('ExportJobsResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + 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 new file mode 100644 index 000000000000..9fd4f08a874e --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_export_jobs_operations.py @@ -0,0 +1,162 @@ +# 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 TYPE_CHECKING +import warnings + +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.polling import LROPoller, NoPolling, PollingMethod +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]] + +class ExportJobsOperations(object): + """ExportJobsOperations 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 + + def _trigger_initial( + self, + resource_group_name, # type: str + vault_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + 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['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 + + def begin_trigger( + self, + resource_group_name, # type: str + vault_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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. + :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 + :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: + """ + 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._trigger_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + 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) + 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 + ) + 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 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 new file mode 100644 index 000000000000..1e7e0d74d189 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_jobs_operations.py @@ -0,0 +1,185 @@ +# 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 TYPE_CHECKING +import warnings + +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.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]] + +class JobsOperations(object): + """JobsOperations 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 + + def list( + self, + resource_group_name, # type: str + vault_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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. + :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 AzureBackupJobResourceList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.AzureBackupJobResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('AzureBackupJobResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(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) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs'} # type: ignore + + def get( + self, + resource_group_name, # type: str + vault_name, # type: str + job_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_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. + :type resource_group_name: str + :param vault_name: The name of the backup vault. + :type vault_name: str + :param job_id: The Job ID. This is a GUID-formatted string (e.g. + 00000000-0000-0000-0000-000000000000). + :type job_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AzureBackupJobResource, or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.AzureBackupJobResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AzureBackupJobResource"] + 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.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') + + # 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) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AzureBackupJobResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/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 new file mode 100644 index 000000000000..cd2604a8468c --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_result_operations.py @@ -0,0 +1,114 @@ +# 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 TYPE_CHECKING +import warnings + +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.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]] + +class OperationResultOperations(object): + """OperationResultOperations 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 + + def get( + self, + operation_id, # type: str + location, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.OperationJobExtendedInfo"] + """Gets the operation status for a resource. + + Gets the operation result for a resource. + + :param operation_id: + :type operation_id: str + :param location: + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OperationJobExtendedInfo, or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.OperationJobExtendedInfo or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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" + 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) + 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 + 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 + 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_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_status_operations.py new file mode 100644 index 000000000000..0bc8bf9eacab --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_status_operations.py @@ -0,0 +1,106 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +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.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]] + +class OperationStatusOperations(object): + """OperationStatusOperations 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 + + def get( + self, + location, # type: str + operation_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.OperationResource" + """Gets the operation status for a resource. + + Gets the operation status for a resource. + + :param location: + :type location: 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 = "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) + 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}/providers/Microsoft.DataProtection/locations/{location}/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 new file mode 100644 index 000000000000..935b39fd586f --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_recovery_points_operations.py @@ -0,0 +1,202 @@ +# 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 TYPE_CHECKING +import warnings + +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.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]] + +class RecoveryPointsOperations(object): + """RecoveryPointsOperations 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 + + 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"] + """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 backup_instance_name: The name of the backup instance. + :type backup_instance_name: str + :param filter: OData filter options. + :type filter: str + :param skip_token: skipToken Filter. + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('AzureBackupRecoveryPointResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(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) + + 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 + + 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" + """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 backup_instance_name: The name of the backup instance. + :type backup_instance_name: str + :param recovery_point_id: + :type recovery_point_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AzureBackupRecoveryPointResource, or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.AzureBackupRecoveryPointResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AzureBackupRecoveryPointResource"] + 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.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') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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('AzureBackupRecoveryPointResource', pipeline_response) + + if cls: + 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 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 new file mode 100644 index 000000000000..a6502b9277ab --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_resource_guards_operations.py @@ -0,0 +1,1310 @@ +# 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 TYPE_CHECKING +import warnings + +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.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]] + +class ResourceGuardsOperations(object): + """ResourceGuardsOperations 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 + + def get_resources_in_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> 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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceGuardResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(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) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + get_resources_in_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/resourceGuards'} # type: ignore + + def get_resources_in_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ResourceGuardResourceList"] + """Returns ResourceGuards collection belonging to a ResourceGroup. + + Returns ResourceGuards collection belonging to a ResourceGroup. + + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceGuardResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(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) + + 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 + + def put( + self, + resource_group_name, # type: str + resource_guards_name, # type: str + parameters, # type: "_models.ResourceGuardResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.ResourceGuardResource" + """Creates or updates a ResourceGuard resource belonging to a resource group. + + Creates or updates a ResourceGuard resource 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 + :param resource_guards_name: The name of ResourceGuard. + :type resource_guards_name: str + :param parameters: Request body for operation. + :type parameters: ~azure.mgmt.dataprotection.models.ResourceGuardResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceGuardResource, or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGuardResource"] + 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.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) + 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('ResourceGuardResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + resource_guards_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ResourceGuardResource" + """Returns a ResourceGuard belonging to a resource group. + + Returns a ResourceGuard 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 + :param resource_guards_name: The name of ResourceGuard. + :type resource_guards_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceGuardResource, or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGuardResource"] + 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.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') + + # 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) + 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('ResourceGuardResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + resource_guards_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a ResourceGuard resource from the resource group. + + Deletes a ResourceGuard resource from the resource group. + + :param resource_group_name: The name of the resource group where the backup vault is present. + :type resource_group_name: str + :param resource_guards_name: The name of ResourceGuard. + :type resource_guards_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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.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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}'} # type: ignore + + 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. + + Updates a ResourceGuard resource belonging to a resource group. For example, updating tags for + a resource. + + :param resource_group_name: The name of the resource group where the backup vault is present. + :type resource_group_name: str + :param resource_guards_name: The name of ResourceGuard. + :type resource_guards_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 + :return: ResourceGuardResource, or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGuardResource"] + 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.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) + 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('ResourceGuardResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}'} # type: ignore + + 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. + + Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. + + :param resource_group_name: The name of the resource group where the backup vault is present. + :type resource_group_name: str + :param resource_guards_name: + :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.paging.ItemPaged[~azure.mgmt.dataprotection.models.DppBaseResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DppBaseResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(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) + + 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 + + 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. + + Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. + + :param resource_group_name: The name of the resource group where the backup vault is present. + :type resource_group_name: str + :param resource_guards_name: + :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.paging.ItemPaged[~azure.mgmt.dataprotection.models.DppBaseResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DppBaseResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(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) + + 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 + + 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. + + Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. + + :param resource_group_name: The name of the resource group where the backup vault is present. + :type resource_group_name: str + :param resource_guards_name: + :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.paging.ItemPaged[~azure.mgmt.dataprotection.models.DppBaseResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DppBaseResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(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) + + 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 + + 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. + + Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. + + :param resource_group_name: The name of the resource group where the backup vault is present. + :type resource_group_name: str + :param resource_guards_name: + :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.paging.ItemPaged[~azure.mgmt.dataprotection.models.DppBaseResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DppBaseResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(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) + + 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 + + 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. + + Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. + + :param resource_group_name: The name of the resource group where the backup vault is present. + :type resource_group_name: str + :param resource_guards_name: + :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.paging.ItemPaged[~azure.mgmt.dataprotection.models.DppBaseResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DppBaseResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(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) + + 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 + + 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. + + Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. + + :param resource_group_name: The name of the resource group where the backup vault is present. + :type resource_group_name: str + :param resource_guards_name: + :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.paging.ItemPaged[~azure.mgmt.dataprotection.models.DppBaseResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DppBaseResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(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) + + 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 + + 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. + + Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. + + :param resource_group_name: The name of the resource group where the backup vault is present. + :type resource_group_name: str + :param resource_guards_name: + :type resource_guards_name: str + :param request_name: + :type request_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DppBaseResource, or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.DppBaseResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DppBaseResource"] + 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.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') + + # 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) + 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('DppBaseResource', pipeline_response) + + if cls: + 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 + + 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. + + Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. + + :param resource_group_name: The name of the resource group where the backup vault is present. + :type resource_group_name: str + :param resource_guards_name: + :type resource_guards_name: str + :param request_name: + :type request_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DppBaseResource, or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.DppBaseResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DppBaseResource"] + 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.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') + + # 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) + 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('DppBaseResource', pipeline_response) + + if cls: + 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 + + 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. + + Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. + + :param resource_group_name: The name of the resource group where the backup vault is present. + :type resource_group_name: str + :param resource_guards_name: + :type resource_guards_name: str + :param request_name: + :type request_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DppBaseResource, or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.DppBaseResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DppBaseResource"] + 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.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') + + # 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) + 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('DppBaseResource', pipeline_response) + + if cls: + 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 + + 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. + + Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. + + :param resource_group_name: The name of the resource group where the backup vault is present. + :type resource_group_name: str + :param resource_guards_name: + :type resource_guards_name: str + :param request_name: + :type request_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DppBaseResource, or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.DppBaseResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DppBaseResource"] + 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.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') + + # 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) + 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('DppBaseResource', pipeline_response) + + if cls: + 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 + + 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. + + Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. + + :param resource_group_name: The name of the resource group where the backup vault is present. + :type resource_group_name: str + :param resource_guards_name: + :type resource_guards_name: str + :param request_name: + :type request_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DppBaseResource, or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.DppBaseResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DppBaseResource"] + 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.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') + + # 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) + 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('DppBaseResource', pipeline_response) + + if cls: + 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 + + 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. + + Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. + + :param resource_group_name: The name of the resource group where the backup vault is present. + :type resource_group_name: str + :param resource_guards_name: + :type resource_guards_name: str + :param request_name: + :type request_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DppBaseResource, or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.DppBaseResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DppBaseResource"] + 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.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') + + # 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) + 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('DppBaseResource', pipeline_response) + + if cls: + 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 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 new file mode 100644 index 000000000000..c35009b32d98 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_restorable_time_ranges_operations.py @@ -0,0 +1,116 @@ +# 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 TYPE_CHECKING +import warnings + +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.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]] + +class RestorableTimeRangesOperations(object): + """RestorableTimeRangesOperations 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 + + 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" + """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 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.AzureBackupFindRestorableTimeRangesRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AzureBackupFindRestorableTimeRangesResponseResource, or the result of cls(response) + :rtype: ~azure.mgmt.dataprotection.models.AzureBackupFindRestorableTimeRangesResponseResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AzureBackupFindRestorableTimeRangesResponseResource"] + 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.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) + 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('AzureBackupFindRestorableTimeRangesResponseResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + 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/py.typed b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/sdk_packaging.toml b/sdk/dataprotection/azure-mgmt-dataprotection/sdk_packaging.toml new file mode 100644 index 000000000000..149166995b49 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/sdk_packaging.toml @@ -0,0 +1,9 @@ +[packaging] +package_name = "azure-mgmt-dataprotection" +package_nspkg = "azure-mgmt-nspkg" +package_pprint_name = "MyService Management" +package_doc_id = "" +is_stable = false +is_arm = true +need_msrestazure = false +need_azuremgmtcore = true diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/setup.cfg b/sdk/dataprotection/azure-mgmt-dataprotection/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/setup.py b/sdk/dataprotection/azure-mgmt-dataprotection/setup.py new file mode 100644 index 000000000000..871070be974e --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/setup.py @@ -0,0 +1,90 @@ +#!/usr/bin/env python + +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- + +import re +import os.path +from io import open +from setuptools import find_packages, setup + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-mgmt-dataprotection" +PACKAGE_PPRINT_NAME = "MyService Management" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace('-', '/') +# a-b-c => a.b.c +namespace_name = PACKAGE_NAME.replace('-', '.') + +# azure v0.x is not compatible with this package +# azure v0.x used to have a __version__ attribute (newer versions don't) +try: + import azure + try: + ver = azure.__version__ + raise Exception( + 'This package is incompatible with azure=={}. '.format(ver) + + 'Uninstall it with "pip uninstall azure".' + ) + except AttributeError: + pass +except ImportError: + pass + +# Version extraction inspired from 'requests' +with open(os.path.join(package_folder_path, 'version.py') + if os.path.exists(os.path.join(package_folder_path, 'version.py')) + else os.path.join(package_folder_path, '_version.py'), 'r') as fd: + version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', + fd.read(), re.MULTILINE).group(1) + +if not version: + raise RuntimeError('Cannot find version information') + +with open('README.md', encoding='utf-8') as f: + readme = f.read() +with open('CHANGELOG.md', encoding='utf-8') as f: + changelog = f.read() + +setup( + name=PACKAGE_NAME, + version=version, + description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), + long_description=readme + '\n\n' + changelog, + long_description_content_type='text/markdown', + license='MIT License', + author='Microsoft Corporation', + author_email='azpysdkhelp@microsoft.com', + url='https://github.com/Azure/azure-sdk-for-python', + classifiers=[ + 'Development Status :: 4 - Beta', + 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'License :: OSI Approved :: MIT License', + ], + zip_safe=False, + packages=find_packages(exclude=[ + 'tests', + # Exclude packages that will be covered by PEP420 or nspkg + 'azure', + 'azure.mgmt', + ]), + install_requires=[ + 'msrest>=0.6.21', + 'azure-common~=1.1', + 'azure-mgmt-core>=1.2.0,<2.0.0', + ], + extras_require={ + ":python_version<'3.0'": ['azure-mgmt-nspkg'], + } +) diff --git a/sdk/dataprotection/ci.yml b/sdk/dataprotection/ci.yml new file mode 100644 index 000000000000..a4fe9ca047ad --- /dev/null +++ b/sdk/dataprotection/ci.yml @@ -0,0 +1,33 @@ +# DO NOT EDIT THIS FILE +# This file is generated automatically and any changes will be lost. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/dataprotection/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/dataprotection/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: dataprotection + Artifacts: + - name: azure-mgmt-dataprotection + safeName: azuremgmtdataprotection